Otis,

You are right. In the example, I mentioned in my mail it doesn�t make sense. The point I wanted to mention was, I am getting different results just by putting brackets around the last term. That was bit confusing for me.

Among the few things, what I want to do with lucene API is to search a particular text on multiple fields of the document and to exclude particular text from same fields. I have written generic logic, which constructs search query by getting search text from HTTP request. I am getting expected results without grouping in case of search on single field. However, when I construct search query on multiple fields using grouping then I don�t get expected results. Apart from examples I have mentioned whether those makes sense or not, what I would really like to know is expected behavior of a query when we group it.

Here is another example
I get expected results on both of these queries
1. +SEARCH_NAME:dvd +SEARCH_NAME:cd -SEARCH_NAME:player
2. +DEF_DOC_FIELD:dvd +DEF_DOC_FIELD:cd -DEF_DOC_F
IELD:player

However, when I try to do this in a single query by grouping I get no result
((+SEARCH_NAME:dvd +SEARCH_NAME:cd ) OR (+DEF_DOC_FIELD:dvd +DEF_DOC_FIELD:cd )) AND ((-SEARCH_NAME:player) OR (-DEF_DOC_F
IELD:player))

I don�t get any results on a single term query like this (and this explains why I am not getting any results in above query)
-SEARCH_NAME:player
Is this a known issue?

Is there any way of dealing with above-mentioned problem other than rearranging query like this?
(+SEARCH_NAME:dvd +SEARCH_NAME:cd -SEARCH_NAME:player) OR (+DEF_DOC_FIELD:dvd +DEF_DOC_FIELD:cd -DEF_DOC_FIELD:player)

Thanks
Abhay






From: Otis Gospodnetic <[EMAIL PROTECTED]>
Reply-To: "Lucene Users List" <[EMAIL PROTECTED]>
To: Lucene Users List <[EMAIL PROTECTED]>
Subject: Re: Query grouping
Date: Fri, 3 Jan 2003 12:33:53 -0800 (PST)

Does the '... AND -.....' part even make sense?
Why not just .... -.... ?
Also, .... AND +.... doesn't make sense, does it?
+<field>:<term> means the term has to be in the result, so AND is not
really needed, is it?
I am not sure if spaces after 'SEARCH_NAME:' make a difference or not

Also, field:term1 field:term2 implies term1 OR term2, so no need for OR
there, especially with +, I think.

Otis


--- Abhay Saswade <[EMAIL PROTECTED]> wrote:
> I am using lucene release 1.2. I am using StandardAnalyzer. Have
> anybody
> faced this problem?
>
> I get same results when I run following queries
>
> 1. (+SEARCH_NAME:jhon +SEARCH_NAME:joy) AND -SEARCH_NAME:chan
> 2. (+SEARCH_NAME:jhon AND +SEARCH_NAME: joy) AND -SEARCH_NAME:chan
> 3. (+SEARCH_NAME:jhon OR +SEARCH_NAME: joy) AND -SEARCH_NAME:chan
>
> But when I regroup the query by putting brackets around the last term
> like
> mentioned below I don�t get any results
>
> 1. (+SEARCH_NAME:jhon +SEARCH_NAME: joy) AND (-SEARCH_NAME:chan)
> 2. (+SEARCH_NAME:jhon AND +SEARCH_NAME: joy) AND (-SEARCH_NAME:chan)
> 3. (+SEARCH_NAME:jhon OR +SEARCH_NAME: joy) AND (-SEARCH_NAME:chan)
>
> This is just an example. I need to do grouping on various fields. Am
> I
> missing something? Is there any document other than
> http://jakarta.apache.org/lucene/docs/queryparsersyntax.html? Can
> somebody
> throw some light on this?
>
> Thanks,
> Abhay
>
>
>
>
>
>
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE*
> http://join.msn.com/?page=features/virus
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to