chriseldredge / Lucene.Net.Linq

LINQ provider to run native queries on a Lucene.Net index
Other
151 stars 66 forks source link

Query with a not-equals clause converts OR statements to AND #77

Closed Farthal closed 9 years ago

Farthal commented 9 years ago

If I try to run a query such as

session.Query().Where(movie => movie.Year == 2010 || movie.Title != "Interstellar")

the results are equivalent to joining the clauses with &&. The || statement and != clause work fine if they aren't used together in a single query.

chriseldredge commented 9 years ago

Sounds like a bug. It should produce a Lucene query like

Year:2010 (*:* -Title:Interstellar)

I'll have to look at the code to see what actual query is being produced.

chriseldredge commented 9 years ago

The actual query produced is

Scalar:2010 -Name:interstellar

This is effectively a boolean AND instead of OR.

chriseldredge commented 9 years ago

Fixed in fa0478721a14601dada12115ed9363f17ddd3a75.

chriseldredge commented 9 years ago

Released in https://github.com/themotleyfool/Lucene.Net.Linq/releases/tag/v3.5.2