You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by stx_gentoo <jl...@chirontech.com> on 2009/07/27 15:29:26 UTC

Question on query

NOTE: I've read the documentation....but I am still a little confused. 

I am passing some advanced queries to web service that is using lucene.

Example:

John AND Beth AND (Lucy OR Gary) AND NOT Frank AND NOT Paul

I am want to use "John"&&"Beth"&&("Lucy"||"Gary")!"Frank"!"Paul" and a few
other variations of this when I pass the query, but no success. I have no
problems using single queries, like the documentation...but no luck on
something more advanced.

I am not familiar with Lucene at all, and I just found out that I need to
interface with service that uses it...

Appreciate any assistance!
-- 
View this message in context: http://www.nabble.com/Question-on-query-tp24680717p24680717.html
Sent from the Lucene - General mailing list archive at Nabble.com.


RE: Question on query

Posted by Uwe Schindler <uw...@thetaphi.de>.
Another good option is the XML query parser. If you are using webservices to
start your lucene query, then it is much better to create an XML
representation of your query and send it through the web service (SOAP as
DOM element passed to xml query parser or parse the REST request using the
xml query parser). The XML query parser is a contrib package.

The important thing is: You should not create query strings
programmatically. Normally query strings should only entered by users. If
you want to have a special query structure, it is much better to build the
query using java objects or use the xml query parser (e.g. if you look for a
term, use TermQuery, for a phrase use PhraseQuery and so on). Here you have
full control on created objects and query types. Furthermore, you cannot
fail with wrong escaping.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: Ted Dunning [mailto:ted.dunning@gmail.com]
> Sent: Monday, July 27, 2009 6:01 PM
> To: general@lucene.apache.org
> Subject: Re: Question on query
> 
> The current Lucene query syntax is specified here:
> http://lucene.apache.org/java/2_3_2/queryparsersyntax.html  Note that use
> of
> ampersands instead of AND is not supported.
> 
> You may want to write your own query parser.  It is relatively easy to do.
> Take a look at the current query parser for some examples.
> 
> You might also like to look at the 2.9 release which (I believe) has a
> package from IBM that makes query syntax much easier to change.
> 
> On Mon, Jul 27, 2009 at 6:29 AM, stx_gentoo
> <jl...@chirontech.com>wrote:
> 
> >
> > NOTE: I've read the documentation....but I am still a little confused.
> >
> > I am passing some advanced queries to web service that is using lucene.
> >
> > Example:
> >
> > John AND Beth AND (Lucy OR Gary) AND NOT Frank AND NOT Paul
> >
> > I am want to use "John"&&"Beth"&&("Lucy"||"Gary")!"Frank"!"Paul" and a
> few
> > other variations of this when I pass the query, but no success. I have
> no
> > problems using single queries, like the documentation...but no luck on
> > something more advanced.
> >
> > I am not familiar with Lucene at all, and I just found out that I need
> to
> > interface with service that uses it...
> >
> > Appreciate any assistance!
> > --
> > View this message in context:
> > http://www.nabble.com/Question-on-query-tp24680717p24680717.html
> > Sent from the Lucene - General mailing list archive at Nabble.com.
> >
> >
> 
> 
> --
> Ted Dunning, CTO
> DeepDyve


Re: Question on query

Posted by Ted Dunning <te...@gmail.com>.
The current Lucene query syntax is specified here:
http://lucene.apache.org/java/2_3_2/queryparsersyntax.html  Note that use of
ampersands instead of AND is not supported.

You may want to write your own query parser.  It is relatively easy to do.
Take a look at the current query parser for some examples.

You might also like to look at the 2.9 release which (I believe) has a
package from IBM that makes query syntax much easier to change.

On Mon, Jul 27, 2009 at 6:29 AM, stx_gentoo <jl...@chirontech.com>wrote:

>
> NOTE: I've read the documentation....but I am still a little confused.
>
> I am passing some advanced queries to web service that is using lucene.
>
> Example:
>
> John AND Beth AND (Lucy OR Gary) AND NOT Frank AND NOT Paul
>
> I am want to use "John"&&"Beth"&&("Lucy"||"Gary")!"Frank"!"Paul" and a few
> other variations of this when I pass the query, but no success. I have no
> problems using single queries, like the documentation...but no luck on
> something more advanced.
>
> I am not familiar with Lucene at all, and I just found out that I need to
> interface with service that uses it...
>
> Appreciate any assistance!
> --
> View this message in context:
> http://www.nabble.com/Question-on-query-tp24680717p24680717.html
> Sent from the Lucene - General mailing list archive at Nabble.com.
>
>


-- 
Ted Dunning, CTO
DeepDyve