On 5/18/2011 9:07 PM, Chris Hostetter wrote:
You could implement a parser like that relatively easily -- just make sure
you put a MatchAllDocsQuery in every BooleanQuery object thta you
construct, and only ever use the PROHIBITED and MANDATORY clause types
(never OPTIONAL) ... the thing is, a parser like that isn't as useful
as you think it might be when dealing with search results. "OPTIONAL"
clauses are where most of the useful factors of scoring documents ocme
into play.
Thanks for the background and ideas, very helpful.
Hmm, but what if it DID use OPTIONAL clause types.... but just turned
all pure-negative clauses into the alternative combination with
MatchAllDocsQuery ( "*:* AND $pure_negative")? Just like lucene query
parser does now, but not only for top-level clauses. Seems like that
might maintain the power of optional clauses for scoring, but still
allow negative clauses to work the 'boolean logic' way people expect --
same rationale that has the query parser doing this at top-level, why
not do it for sub-clauses as well? Does that have any promise do you think?
Jonathan