You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by sayeed <ab...@gmail.com> on 2013/10/18 09:28:11 UTC

Complex Queries in solr

Hi,
Is it possible to search complex queries like 
(consult* or advis*) NEAR(40) (fee or retainer or salary or bonus)
in solr




-----
Sayeed
--
View this message in context: http://lucene.472066.n3.nabble.com/Complex-Queries-in-solr-tp4096288.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Complex Queries in solr

Posted by Roman Chyla <ro...@gmail.com>.
i just tested it whether our 'beautifu' parser supports it, and funnily
enough, it does :-)
https://github.com/romanchyla/montysolr/commit/f88577345c6d3a2dbefc0161f6bb07a549bc6b15

but i've (kinda) given up hope that people need powerful query parsers in
the lucene world, the LUCENE-5014 is there sitting without attention for
eons ... so your best bet is probably to use LucidWorks parser (but i don't
know if it supports proximity searches combined with wildcards and
booleans) or you can create a custom query plugin that builds the following
query

spanNear([spanOr([SpanMultiTermQueryWrapper(all:consult*),
SpanMultiTermQueryWrapper(all:advis*)]), spanOr([all:fee,
all:retainer, all:salary, all:bonus])], 4, true)

you can draw inspiration from here:
https://github.com/romanchyla/montysolr/blob/master/contrib/antlrqueryparser/src/java/org/apache/lucene/queryparser/flexible/aqp/builders/AqpNearQueryNodeBuilder.java
https://github.com/romanchyla/montysolr/blob/master/contrib/antlrqueryparser/src/java/org/apache/lucene/queryparser/flexible/aqp/builders/SpanConverter.java


but i think you are aware that such a query is NOT going to be very
efficient. especially when proximity=40 ;-)

hth

roman



On Fri, Oct 18, 2013 at 3:28 AM, sayeed <ab...@gmail.com> wrote:

> Hi,
> Is it possible to search complex queries like
> (consult* or advis*) NEAR(40) (fee or retainer or salary or bonus)
> in solr
>
>
>
>
> -----
> Sayeed
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Complex-Queries-in-solr-tp4096288.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Complex Queries in solr

Posted by Furkan KAMACI <fu...@gmail.com>.
You should star reading from here:
https://cwiki.apache.org/confluence/display/solr/The+Standard+Query+Parser and
you should have a look at Fuzzy Searches section. On the other hand read
here: http://wiki.apache.org/solr/FunctionQuery


2013/10/18 sayeed <ab...@gmail.com>

> Hi,
> Is it possible to search complex queries like
> (consult* or advis*) NEAR(40) (fee or retainer or salary or bonus)
> in solr
>
>
>
>
> -----
> Sayeed
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Complex-Queries-in-solr-tp4096288.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>