lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Demoting results
Date Sat, 27 Mar 2004 02:29:40 GMT
I have not been able to work out how to get custom coordination going to 
demote results based on a specific term but have an alternative suggestion
that looks like it might work:

I've created a "MissingTermQuery" - which is the opposite of a TermQuery 
and can be used to boost documents that DONT have a specific term. 
This seems to have the desired effect of demoting but not necessarily 
precluding documents with a specific term but has a side effect of producing 
some irrelevant low scoring results when none of the other terms match. 
This can be counteracted by making  the positive terms mandatory eg

+(wine beer) !cheap

The ! character in the example above is used to denote a MissingTermQuery.
This says find all documents with "wine" or "beer" and favour ones that dont
used the word "cheap". Of course MissingTerms can be boosted with a value 
to emphasise the effect eg !cheap^2

It doesn't look like there's currently an elegant way of negating all the other 
query  types (phrase, prefix...) without creating new "MissingXxxQuery" classes 
for each type.

I've put an example implementation here:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message