lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Volodymyr Bychkoviak <vbychkov...@i-hypergrid.com>
Subject Re: Negative Field Boost
Date Thu, 26 May 2005 17:16:57 GMT
here you can play with boost

(+includes:(red frogs) -excludes:(red frogs))^2.0 excludes:(red frogs)^0.5

you can also play with numbers to achieve best results.

this is first solution I've thought about(I mean there may be more efficient solutions)


regards,

Volodymyr Bychkoviak


Ryan Skow wrote:

>That works very well - thank you for your quick reply.  As a followup
>question, what if the desired effect was to force hits containing terms in
>the 'excludes' field to appear below other hits?
>
>Example using the same setup as before:
>  Query: red frogs
>  Result: both documents would be returned, but DocumentB would appear
>before DocumentA since it doesn't have any matching terms in the
>excludes field
>
>Again, thanks for your reply - it definitely satisfied my initial request.
>
>Ryan
>
>  
>
>>string query should look like: "+includes:(red frogs) -excludes:(red
>>frogs)"
>>
>>You can play with MultiFieldQueryParser a bit.
>>
>>regards,
>>Volodymyr Bychkoviak
>>
>>Ryan Skow wrote:
>>
>>    
>>
>>>Here is the logical structure of the document I'm working with:
>>> The 'Document' has two fields:
>>>   'includes' - List of terms that provide positive boost
>>>   'excludes' - List of terms that provide negative boost
>>>
>>>Here is a usage scenario:
>>>   DocumentA
>>>     includes: red green blue
>>>     excludes: frogs birds snails
>>>
>>>   DocumentB
>>>     includes: red green blue
>>>     excludes: <empty>
>>>
>>>Here is the desired effect for a couple query strings:
>>>   Query: red
>>>   Result: both documents would be returned with equal score
>>>
>>>   Query: red frogs
>>>   Result: only DocumentB would be returned because DocumentA excludes
>>>frogs
>>>
>>>My question is: can Lucene do this with a single query?  One option is to
>>>do separate queries searching first the 'includes' and then on the
>>>'excludes' field, then removing documents from the 'includes' Hits that
>>>exist in the 'excludes' Hits.  This solution to works, but is somewhat
>>>cumbersome and inefficient.
>>>
>>>I've tried calling excludesField.setBoost((float)-1) as well as passing
>>>small decimals in the setBoost method, but that still adds a smaller
>>>value
>>>to the score instead of subtracting from it.
>>>
>>>Has anyone solved this problem in better/different ways?
>>>
>>>Thanks!
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>>For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message