Search Postgresql Archives

Re: fts, compond words?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux