Date: 2004-03-29T13:51:44 Editor: 194.106.34.5 <> Wiki: Jakarta Lucene Wiki Page: CommunityContributions URL: http://wiki.apache.org/jakarta-lucene/CommunityContributions
no comment Change Log: ------------------------------------------------------------------------------ @@ -2,8 +2,13 @@ == Demoting results == - I've found an elegant way of doing this now for all types of search - a new "NegatingQuery" class that takes any Query object in its constructor - and selects all documents that DON'T match and gives them a user-definable boost. - - url: http://www.inperspective.com/lucene/demote.zip [[BR]] - contact: markharw00d at yahoo dot co dot uk +The BoostingQuery class can be used to effectively demote results that match a given query. Unlike the "NOT" clause this still selects documents that contain undesirable terms but reduces their overall score: + + Query balancedQuery = + new BoostingQuery(positiveQuery, negativeQuery, 0.01f); + +In this scenario the positiveQuery contains the mandatory, desirable criteria which is used to select all matching documents and the negativeQuery contains the undesirable elements which are simply used to lessen the scores. Documents that match the negativeQuery have their score multiplied by the supplied "boost" parameter (so this should be less than one to achieve a downgrading effect). + +This code was made available here: + url: http://marc.theaimsgroup.com/?l=lucene-user&m=108058407130459&w=2 [[BR]] + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]