Re: fts, compond words?
От | Marcus Engene |
---|---|
Тема | Re: fts, compond words? |
Дата | |
Msg-id | 4395799B.7080406@engene.se обсуждение исходный текст |
Ответ на | Re: fts, compond words? (Oleg Bartunov <oleg@sai.msu.su>) |
Ответы |
Re: fts, compond words?
Re: fts, compond words? |
Список | pgsql-general |
Oleg Bartunov wrote: > On Mon, 5 Dec 2005, Marcus Engene wrote: >> I realized from the documentation that I'm not looking for >> compound words after all, I meant "exact phrase". >> >> I can't see how to make rank tell me which results has an >> exact phrase? Like "there must be a occurence of 'new' before >> 'york'" (stemmed not really exact phrase)? > > http://www.sai.msu.su/~megera/oddmuse/index.cgi/Tsearch_V2_Notes > > Phrase search > This tip is by Mike Rylander > > To do phrase searching just add an additional WHERE clause to your query: > > SELECT id FROM tab WHERE ts_idx_col @@ to_tsquery('history&lesson') > AND text_col ~* '.*history\\s+lesson.*'; > > The full-text index will still be used, and the regex will be used to > prune the results afterwards. Hi, Thanks for the answer, Oleg and Mike. This, I guess, will be problematic in a query like A & (B | C) or a more complex expression. say C is "New York" and that tsearch receives A & (B | (new & york)) I cannot just add the regexp afterwards. What if B is true? What would be nice to have, given ofcourse the index isn't stripped is something like A & (B | (New OperatorTheNextWordMustFollow York)) Would something like that be doable? Right now, intuitively, it would be two trees in the where clause: tsearch(A & B) OR (tsearch (A & C) AND regexpmatch(C)) ..and a nightmare in complex queries. Best regards, Marcus
В списке pgsql-general по дате отправления: