I understand that it would be best to have a UI that mapped lists of terms
to MUST, MUST_NOT and SHOULD, but I'm currently constrained to using the
QueryParser with boolean operators.

Given that, I was thinking that the addition of "*:*" (in 2.1) to represent
MatchAllDocsQuery might help solve:

"  NOT Chair " is the problem ... you can't have a negative clause in
isolation by itself -- it doesn't make sense because there isn't anything
positively selecting results for you to then exclude results from.

by making that: "*:* NOT Chair"

To test, I indexed these documents:

 *DocID*

*Body Value*

0

A B C

1

A B C D

2

A C D

3

B C D

4

C D

5

B

Searching in Luke, here's what I see:

*Query*

*Parsed As*

*Expected Matches*

*Actual Matches*

NOT B

-body:B

2, 4

<none>

*:* NOT B

MatchAllDocsQuery -body:B

2, 4

2, 4, 5

*.* AND NOT B

+MatchAllDocsQuery -body:B

2, 4

2, 4, 5

Can someone explain why doc 5 is matched for both "*:* NOT B" and  "*.* AND
NOT B"?
Are my Expected Matches incorrect?

Thanks, david


On 11/3/06, Chris Hostetter <[EMAIL PROTECTED]> wrote:


: When I enter the query: "Table AND NOT Chair"  I get one hit, doc3
: When I enter the query: "Table AND (NOT Chair)" I get 0 hits.
:
: I had thought that both queries would return the same results.  Is this
a
: bug, or, am I not understanding the query language correctly?

it's a confusing eccentricity of the QueryParser syntax ... as a general
rule, thing in parens need to be self contained, effective, queries ... if

you have something in parens which would not make sense as a query by
itself, then it won't make any more sense as part of a larger query.

In your case, the query "  NOT Chair " is the problem ... you can't have
a negative clause in isolation by itself -- it doesn't make sense because
there isn't anything positively selecting results for you to then exclude
results from.


As a side not: i strongly encourage you to train yourself to think in
terms of MUST, MUST_NOT and SHOULD (which are represented in the query
parser as the prefixes "+", "-" and the default) instead of in terms of
AND, OR, and NOT ... Lucene's BooleanQuery (and thus Lucene's QueryParser)

is not a strict Boolean Logic system, so it's best not to try and think
of it like one.

-Hoss


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


Reply via email to