Re: Regular Expression for 'and' instead of 'or'
От | Rajesh Kumar Mallah |
---|---|
Тема | Re: Regular Expression for 'and' instead of 'or' |
Дата | |
Msg-id | 3C7735D6.7E87781A@trade-india.com обсуждение исходный текст |
Ответ на | Regular Expression for 'and' instead of 'or' ("Samuel J. Sutjiono" <ssutjiono@wc-group.com>) |
Список | pgsql-sql |
How about using the contrib/tsearch module <br />that uses gist indexes. <p>moreover it has builtin support for wordstemming,morphology <br />and stuff. (to my knowledge) <p>you would ofcourse require to upgrade to PGSQL7.2 <br /> <p>excreptsfrom README.tsearch contrib module. <br />================ <br /><tt>and now you can search all titles with words'patch' and 'gist':</tt><br /><tt> select title from titles where titleidx ## 'patch&gist';</tt><tt></tt><p><tt>Here,## is a new operation defined for type 'txtidx' which could use index</tt><br/><tt>(if exists) built on titleidx. This operator uses morphology to</tt><br /><tt>expand query, i.e.</tt><br/><tt> ## 'patches&gist' will find titles with 'patch' and 'gist' also.</tt><br /><tt>If you want to providequery as is, use operator @@ instead:</tt><br /><tt> select title from titles where titleidx @@ 'patch&gist';</tt><br/> <br /> <p>"Samuel J. Sutjiono" wrote: <blockquote type="CITE"><style></style><font face="Arial"><fontsize="-1">This expression matches the word socks or shoes or nike in product category</font></font><b><fontface="Arial"><font size="-1">where productdescr ~* '(socks|shoes|nike)'</font></font></b> <fontface="Arial"><font size="-1">Does anybody know what the expression should be if I want to do <b>'and'</b> of those key words instead of <b>'or'</b> ?</font></font> <font face="Arial"><font size="-1">Thanks,</font></font><fontface="Arial"><font size="-1">Sam</font></font></blockquote>
В списке pgsql-sql по дате отправления: