2016-06-28 20 views

回答

2

您是否嘗試過帶空停止詞文件的simple字典?

創建一個空的停用詞文件$(pg_config --sharedir)/tsearch_data/empty.stop並運行:

CREATE TEXT SEARCH DICTIONARY machine (
    TEMPLATE = pg_catalog.simple, 
    STOPWORDS = empty 
); 

CREATE TEXT SEARCH CONFIGURATION machine (
    PARSER = default 
); 

ALTER TEXT SEARCH CONFIGURATION machine 
    ADD MAPPING FOR asciiword, word, numword, asciihword, hword, 
        numhword, hword_asciipart, hword_part, 
        hword_numpart, email, protocol, url, host, 
        url_path, file, sfloat, float, int, uint, 
        version, tag, entity, blank 
    WITH machine; 

然後你就可以得到:

test=> SELECT * FROM ts_debug('machine', 'move'); 
    alias | description | token | dictionaries | dictionary | lexemes 
-----------+-----------------+-------+--------------+------------+--------- 
asciiword | Word, all ASCII | move | {machine} | machine | {move} 
(1 row) 

如果你想在默認情況下此配置(這樣你就不必指定'machine'始終),請適當更改參數default_text_search_config

+0

謝謝!只是懷疑,這將與XML領域的工作? –

+1

這應該適用於XML。 –

相關問題