Hi, Oleg Bartunov: First thanks for your quick replay. Could you explain it a little more on "it's general limitation/feature"? I just confuse that to_tsquery('item') function will return a tsquery type which is same as 'item'::tsquery, to my understanding. Let me explain what I want: First Step: extract top K tokens I have a table with a column as tsvector type. Some records in this column are too big, which contain hundreds tokens. I just want the top K tokens based on the frequency, for example top 5. I am not sure there is a direct way to get such kind top K tokens. I just read them out in Java and count frequency for each token and sort them. Second Step: generate query Now I will use these tokens to construct a query to search other vectors in the same table. I can not directly use to_tsquery() due to two reasons: 1) The default logic operator in to_tsquery() is
"&" but what I need it "|". 2) Since the tokens are from tsvector, they are already normalized. If I use to_tsquery() again, they will be normalized again! For example, “course” -> “cours” -> “cour”. So I just concatenate the top K tokens with “|” and directly use "::tsquery ". Unfortunately, as you say "it's
general limitation/feature”, I can not do that. I checked your manual “Full-Text Search in PostgreSQL A Gentle Introduction”, but could not figure out how. So is it possible to implement what I want in FTS? If so, how? Thank! Xu --- On Sun, 1/24/10, Oleg Bartunov <oleg@xxxxxxxxxx> wrote:
|