You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by SK R <rs...@gmail.com> on 2007/03/22 12:06:58 UTC

how ungrouped query handled?

Hi,
     Can anyone explain how lucene handles the belowed query?
    My query is *field1:source AND (field2:name OR field3:dest)* . I've
given this string to queryparser and then searched by using searcher. It
returns correct results. It's query.toString() print is :: +field1:source
+(field2:name field3:dest)
    But if i don't group my terms (i.e) my query : *field1:source AND
field2:name OR field3:dest *,then it gives the result of  first two term's
search result. It doesn't search 3rd term. It's query.toString() print is ::
+field1:source +field2:name field3:dest.
If i use same boolean operator between all terms, then it returns correct
results.
Why it doesn't search the terms after 2nd term if grouping not used?

Thanks & Regards
RSK

Re: how ungrouped query handled?

Posted by SK R <rs...@gmail.com>.
Thanks for your reply and this useful links.

On 3/23/07, Chris Hostetter <ho...@fucit.org> wrote:
>
>
> see also the FAQ "Why am I getting no hits / incorrect hits?" which points
> to...
>
> http://wiki.apache.org/lucene-java/BooleanQuerySyntax
>
> ...I've just added some more words of wisdom there from past emails.
>
>
> : Date: Thu, 22 Mar 2007 09:51:15 -0400
> : From: Erick Erickson <er...@gmail.com>
> : Reply-To: java-user@lucene.apache.org
> : To: java-user@lucene.apache.org
> : Subject: Re: how ungrouped query handled?
> :
> : This is a pretty common issue that I've been grappling with by chance
> : recently. The main point is that the parser is NOT a boolean logic
> : parser.....
> :
> : Search the mail archive for the thread "bad query parser bug" and
> : you'll find a good discussion.
> :
> : I tried using PrecedenceQueryParser, but that didn't work for
> : me very well, search the mail archive on that and you'll see some
> : examples of why.
> :
> : I solved this problem for my immediate issues by writing a very
> : quick-and-dirty parenthesizer for my raw query. If it wasn't going
> : on summer, I might see if I can contribute something by
> : seeing if there's a way I can see to fix PrecedenceQueryParser.
> :
> : Best
> : Erick
> :
> : On 3/22/07, SK R <rs...@gmail.com> wrote:
> : >
> : > Hi,
> : >      Can anyone explain how lucene handles the belowed query?
> : >     My query is *field1:source AND (field2:name OR field3:dest)* .
> I've
> : > given this string to queryparser and then searched by using searcher.
> It
> : > returns correct results. It's query.toString() print is ::
> +field1:source
> : > +(field2:name field3:dest)
> : >     But if i don't group my terms (i.e) my query : *field1:source AND
> : > field2:name OR field3:dest *,then it gives the result of  first two
> term's
> : > search result. It doesn't search 3rd term. It's query.toString() print
> is
> : > ::
> : > +field1:source +field2:name field3:dest.
> : > If i use same boolean operator between all terms, then it returns
> correct
> : > results.
> : > Why it doesn't search the terms after 2nd term if grouping not used?
> : >
> : > Thanks & Regards
> : > RSK
> : >
> :
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: how ungrouped query handled?

Posted by Chris Hostetter <ho...@fucit.org>.
see also the FAQ "Why am I getting no hits / incorrect hits?" which points
to...

http://wiki.apache.org/lucene-java/BooleanQuerySyntax

...I've just added some more words of wisdom there from past emails.


: Date: Thu, 22 Mar 2007 09:51:15 -0400
: From: Erick Erickson <er...@gmail.com>
: Reply-To: java-user@lucene.apache.org
: To: java-user@lucene.apache.org
: Subject: Re: how ungrouped query handled?
:
: This is a pretty common issue that I've been grappling with by chance
: recently. The main point is that the parser is NOT a boolean logic
: parser.....
:
: Search the mail archive for the thread "bad query parser bug" and
: you'll find a good discussion.
:
: I tried using PrecedenceQueryParser, but that didn't work for
: me very well, search the mail archive on that and you'll see some
: examples of why.
:
: I solved this problem for my immediate issues by writing a very
: quick-and-dirty parenthesizer for my raw query. If it wasn't going
: on summer, I might see if I can contribute something by
: seeing if there's a way I can see to fix PrecedenceQueryParser.
:
: Best
: Erick
:
: On 3/22/07, SK R <rs...@gmail.com> wrote:
: >
: > Hi,
: >      Can anyone explain how lucene handles the belowed query?
: >     My query is *field1:source AND (field2:name OR field3:dest)* . I've
: > given this string to queryparser and then searched by using searcher. It
: > returns correct results. It's query.toString() print is :: +field1:source
: > +(field2:name field3:dest)
: >     But if i don't group my terms (i.e) my query : *field1:source AND
: > field2:name OR field3:dest *,then it gives the result of  first two term's
: > search result. It doesn't search 3rd term. It's query.toString() print is
: > ::
: > +field1:source +field2:name field3:dest.
: > If i use same boolean operator between all terms, then it returns correct
: > results.
: > Why it doesn't search the terms after 2nd term if grouping not used?
: >
: > Thanks & Regards
: > RSK
: >
:



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: how ungrouped query handled?

Posted by Erick Erickson <er...@gmail.com>.
This is a pretty common issue that I've been grappling with by chance
recently. The main point is that the parser is NOT a boolean logic
parser.....

Search the mail archive for the thread "bad query parser bug" and
you'll find a good discussion.

I tried using PrecedenceQueryParser, but that didn't work for
me very well, search the mail archive on that and you'll see some
examples of why.

I solved this problem for my immediate issues by writing a very
quick-and-dirty parenthesizer for my raw query. If it wasn't going
on summer, I might see if I can contribute something by
seeing if there's a way I can see to fix PrecedenceQueryParser.

Best
Erick

On 3/22/07, SK R <rs...@gmail.com> wrote:
>
> Hi,
>      Can anyone explain how lucene handles the belowed query?
>     My query is *field1:source AND (field2:name OR field3:dest)* . I've
> given this string to queryparser and then searched by using searcher. It
> returns correct results. It's query.toString() print is :: +field1:source
> +(field2:name field3:dest)
>     But if i don't group my terms (i.e) my query : *field1:source AND
> field2:name OR field3:dest *,then it gives the result of  first two term's
> search result. It doesn't search 3rd term. It's query.toString() print is
> ::
> +field1:source +field2:name field3:dest.
> If i use same boolean operator between all terms, then it returns correct
> results.
> Why it doesn't search the terms after 2nd term if grouping not used?
>
> Thanks & Regards
> RSK
>