lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: Unexpected Results - using should and must in boolean query
Date Sun, 12 Sep 2010 13:36:48 GMT
This is expected. The clause you add with MUST does just
that, any documents returned MUST have that term. The SHOULD
part of the query just says will simply bump the scores of
documents with that clause.

As to scores being different on the queries (and I'm having a hard time
understanding your point, so I may be way off base here), comparing
scores between different queries is meaningless. Scores are ways
of ranking documents in a single query. See the scoring discussion
on the Wiki for why...

Best
Erick

On Sun, Sep 12, 2010 at 8:04 AM, liat oren <oren.liat@gmail.com> wrote:

> Hi,
>
> I am running a query and get some unexpected results.
>
> When I run boolean query on a text field for the word X, using occur =
> SHOULD, the results contain the word X.
>
> However, when I add another boolean query on another field (country) for
> the
> word Y, using occur = MUST, in the results I get only documents in country
> Y, but from some reason, not only that I get documents that don't contain
> the word X, they get higher score than those contain the word X.
>
> If I change the occur of the word X in the query to MUST, it of course
> fixes
> it, but I don't understand why the SHOULD "lost" its "power" when I added
> the MUST on another field.
>
> Could something like this can happen?
> How can it be solved?
>
> Many thanks,
> Liat
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message