[GENERAL] OR tsquery
to_tsquery and plainto_tsquery produce AND tsquery 'apple banana orange' - 'apple' 'banana' 'orange' I can't see anything that will produce OR tsquery. 'apple banana orange' - 'apple' | 'banana' | 'orange' The only thing I can think of is looping on ts_lexize that looks not very efficient in plpgsql. Am I missing something? thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] OR tsquery
Ivan Sergio Borgonovo m...@webthatworks.it writes: to_tsquery and plainto_tsquery produce AND tsquery 'apple banana orange' - 'apple' 'banana' 'orange' Only the latter. Try to_tsquery again: regression=# select to_tsquery('foo bar'); ERROR: syntax error in tsquery: foo bar regression=# select to_tsquery('foo bar'); to_tsquery --- 'foo' 'bar' (1 row) regression=# select to_tsquery('foo | bar'); to_tsquery --- 'foo' | 'bar' (1 row) regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] OR tsquery
Ivan, did you ever read official documentation ? http://www.postgresql.org/docs/8.4/static/textsearch-controls.html Oleg On Sat, 16 Jan 2010, Ivan Sergio Borgonovo wrote: to_tsquery and plainto_tsquery produce AND tsquery 'apple banana orange' - 'apple' 'banana' 'orange' I can't see anything that will produce OR tsquery. 'apple banana orange' - 'apple' | 'banana' | 'orange' The only thing I can think of is looping on ts_lexize that looks not very efficient in plpgsql. Am I missing something? thanks Regards, Oleg _ Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), Sternberg Astronomical Institute, Moscow University, Russia Internet: o...@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(495)939-16-83, +007(495)939-23-83 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] OR tsquery
On Sat, 16 Jan 2010 19:10:45 +0300 (MSK) Oleg Bartunov o...@sai.msu.su wrote: Ivan, did you ever read official documentation ? http://www.postgresql.org/docs/8.4/static/textsearch-controls.html Yes but I still can't find something that works like plainto_tsquery but with | or any example that wouldn't make obtaining that result convoluted. plainto_tsquery do a couple of stuff that I find hard to replicate with the available functions. It split a string into lexemes. It loops over the lexemes to build up the query with . Something like: select ( string_to_array( strip( to_tsvector('pg_catalog.english', 'orange banana woods booking'))::text , ' ') )[i] from generate_series(0,3) s(i); and then gluing up the pieces with |. And the above example still miss to solve some of the details like cleaning the '. Another option would be to return the tsvector to the client and then build the tsquery there and send it back to the server. I'm on 8.3 but I don't think it makes any real difference for this. Sorry if I'm still missing the obvious. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general