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 Niraj Alok <ni...@emacmillan.com> on 2004/07/07 15:05:14 UTC

boolean operators and score

Hi Guys,

Finally I have sorted the problem of hits score thanks to the great help of
Franck.

I have hit another problem with the boolean operators now.
When I search for "Winston and churchill" i get a set of perfectly
acceptable results.
But when I change the order, "churchill and winston" the results are the
same but the order of the results changes.

Is it possible to have the same order (hits.score) irrespective of which
term is given before or after?


Regards,
Niraj

Re: boolean operators and score

Posted by Brisbart Franck <Fr...@kelkoo.net>.
Niraj Alok wrote:
> Hi Guys,
> 
> Finally I have sorted the problem of hits score thanks to the great help of
> Franck.
> 
> I have hit another problem with the boolean operators now.
> When I search for "Winston and churchill" i get a set of perfectly
> acceptable results.
> But when I change the order, "churchill and winston" the results are the
> same but the order of the results changes.
> 
I don't it is interpreted as the same request. As you should know the 
terms of a boolean query have a 'required' flag.
As to me, your request 'winston and churchill' is interpreted as 
'winston (not required)' and 'churchill (required)'
But your request 'churchill and winston' is interpreted as 'churchill 
(not required)' and 'winston (required)'

I think you'd rather search for 'and winston and churchill' (which 
should be the same than 'and churchill and winston') to have the both 
terms required

Franck


> Is it possible to have the same order (hits.score) irrespective of which
> term is given before or after?
> 
> 
> Regards,
> Niraj
> 


-- 
Franck Brisbart
R&D
http://www.kelkoo.com


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


Re: boolean operators and score

Posted by Brisbart Franck <Fr...@kelkoo.net>.
There's no need to sort the words here.
You just have to ensure that the lucene query built is the same for the 
requests that you consider as equivalent.
I mean that if a request 'word1 word2' gives results different than 
'word2 word1', the problem is in your query parser or in the way you 
give the requests to it.
I keep on saying that with the lucene query parser, the requests 'word1 
and word2' & the request 'word2 and word1' are different because of the 
'required' flag.

Franck

Niraj Alok wrote:
> Hi Don,
> 
> After months of struggling with lucene and finally achieving the complex
> relevancy desired, the client would kill me if i now make that relevancy all
> lost.
> 
> I am trying to do it with the way Franck suggested by sorting the words the
> user has entered, but otherwise, isn't this a bug of lucene ?
> 
> Regards,
> Niraj
> 
> ----- Original Message -----
> From: "Don Vaillancourt" <do...@webimpact.com>
> To: "Lucene Users List" <lu...@jakarta.apache.org>
> Sent: Thursday, July 08, 2004 7:15 PM
> Subject: Re: boolean operators and score
> 
> 
> 
>>What could actually be done is perhaps sort the search result by document
>>id.  Of course your relevancy will be all shot, but at least you would
> 
> have
> 
>>control over the sorting order.
>>
>>
>>



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


Re: boolean operators and score

Posted by Niraj Alok <ni...@emacmillan.com>.
Hi Don,

After months of struggling with lucene and finally achieving the complex
relevancy desired, the client would kill me if i now make that relevancy all
lost.

I am trying to do it with the way Franck suggested by sorting the words the
user has entered, but otherwise, isn't this a bug of lucene ?

Regards,
Niraj

----- Original Message -----
From: "Don Vaillancourt" <do...@webimpact.com>
To: "Lucene Users List" <lu...@jakarta.apache.org>
Sent: Thursday, July 08, 2004 7:15 PM
Subject: Re: boolean operators and score


> What could actually be done is perhaps sort the search result by document
> id.  Of course your relevancy will be all shot, but at least you would
have
> control over the sorting order.
>
>
>
>
>
>

Re: boolean operators and score

Posted by Don Vaillancourt <do...@webimpact.com>.
What could actually be done is perhaps sort the search result by document 
id.  Of course your relevancy will be all shot, but at least you would have 
control over the sorting order.

At 09:05 AM 07/07/2004, you wrote:
>Hi Guys,
>
>Finally I have sorted the problem of hits score thanks to the great help of
>Franck.
>
>I have hit another problem with the boolean operators now.
>When I search for "Winston and churchill" i get a set of perfectly
>acceptable results.
>But when I change the order, "churchill and winston" the results are the
>same but the order of the results changes.
>
>Is it possible to have the same order (hits.score) irrespective of which
>term is given before or after?
>
>
>Regards,
>Niraj

Don Vaillancourt
Director of Software Development

WEB IMPACT INC.
416-815-2000 ext. 245
email: donv@web-impact.com
web: http://www.web-impact.com




This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright.  If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.












Re: boolean operators and score

Posted by Don Vaillancourt <do...@webimpact.com>.
I think that the only way to resolve this would be to order your keywords 
alphabetically to control the result every single time prior to submitting 
your search to Lucene.  I don't know if Lucene does this, but I'm fairly 
sure that sorting the criteria would be a complex matter.

At 09:05 AM 07/07/2004, you wrote:
>Hi Guys,
>
>Finally I have sorted the problem of hits score thanks to the great help of
>Franck.
>
>I have hit another problem with the boolean operators now.
>When I search for "Winston and churchill" i get a set of perfectly
>acceptable results.
>But when I change the order, "churchill and winston" the results are the
>same but the order of the results changes.
>
>Is it possible to have the same order (hits.score) irrespective of which
>term is given before or after?
>
>
>Regards,
>Niraj

Don Vaillancourt
Director of Software Development

WEB IMPACT INC.
416-815-2000 ext. 245
email: donv@web-impact.com
web: http://www.web-impact.com




This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright.  If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.












Re: boolean operators and score

Posted by Niraj Alok <ni...@emacmillan.com>.
If i do it by sorting the input before sending it to lucene, it could become
unmanageable to handle and could also throw unexpected results for the user.

e.g . if i type: winston churchill and world war and germany

i could split the string by "and" and get the sorted string as (churchill
winston) and (germany) and (war world) .
this would obviously make the hits.score throw up unexpected results.

isnt there any other solution which comes from lucene itself ? i am using
1.4 final

Regards,
Niraj