lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <yo...@apache.org>
Subject Re: Negative boosts
Date Thu, 14 Dec 2006 15:04:55 GMT
On 12/14/06, Derek Watson <watson@wayspa.com> wrote:
> I have been developing a new search application based on Solr (Very
> nice!) using dismax. We are using query-time boosts to provide better
> search results for user queries and index-time boosts to promote
> certain documents over others.
>
> My question is about the latter: We have a "position" field available
> at index time that is an integer value, 0 being the 1st position, 1
> being the 2nd position, 99 being the hundredth, etc.  How do I get
> Solr to return documents in that same order?

If you want documents returned in the same order as a field, it's
easy... you sort!
If you want the value of a field to influence a score, not determine
the exact sort order, you can use FunctionQuery (currently hacked into
the query parser as _val_:myfield)

> Is it possible to apply a
> negative boost?
>
> <doc boost="-0.0">...</doc>
> <doc boost="-0.1">...</doc>
> <doc boost="-0.2">...</doc>
>
> I notice in the documentation for parseFieldBoosts that the routine
> "Doesn't care if boost info is negative, you're on your own.", but
> what does that mean?

AFAIK, negative scores and boosts at query time aren't really
prohibited in Lucene, but neither are they really supported.  I would
avoid them.

Negative boosts would be mapped to zero boosts during indexing... this
is due to the way norms are represented in the Lucene index:
http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/util/SmallFloat.java?view=markup
Note that there are only 3 mantissa bits in the 8 bit float, so small
distinctions at index time are effectively discarded.


-Yonik

Mime
View raw message