2011-05-27 72 views
4

這是一個錯誤還是一個特性?我已經創建了tsvector屬性的索引(不使用字典)。PostgreSQL tsvector tsquery錯誤?

查詢

SELECT title 
FROM table 
WHERE title_tsv @@ to_tsquery('basic') and 
title_tsv @@ to_tsquery('inst:*') 

回報 「本能」。但是,查詢

SELECT title 
FROM table 
WHERE title_tsv @@ to_tsquery('basic') and 
title_tsv @@ to_tsquery('in:*') 

根本沒有返回任何記錄。我不明白爲什麼第二個(更一般的查詢)返回的結果比第一個查詢少?

再見

回答

4
[email protected]@[local] =# select to_tsquery('in:*'); 
NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored 

針對查詢始終返回false,所以大概匹配?

也許你想對'*'中的基本&進行單個查詢?

+0

非常感謝您的幫助!一個後續問題:如果我不使用字典,這是否意味着PostgreSQL不會使用停用詞列表? – itsame69 2011-05-28 11:09:38

+1

如果你沒有指定配置,它只是使用默認值,可能是'english'(即英文不動詞)。嘗試指定一個'simple'的配置,或者用英語詞法分析創建一個新的配置,但是一個空的字典。 – araqnid 2011-05-28 17:58:37

+0

完美!非常感謝! – itsame69 2011-05-28 19:05:36