On 01/22/2008 at 8:49 PM, Grant Ingersoll wrote:
> On Jan 22, 2008, at 6:06 PM, Steven A Rowe wrote:
> > On 01/21/2008 at 2:59 PM, Itamar Syn-Hershko wrote:
> > > 2) How would I set the boosts for the headers and footnotes?
> > > I'd rather have it stored within the index file than have to
> > > append it to each and every query I will execute, but I'm
> > > open to suggestions. I'm more interested in performance and
> > > flexibility.
> > 
> > AFAIK, there is no way currently in Lucene to set index-time per-
> > field boosts - only per-document boosts are supported.
> 
> I'm not following this part.  Is this different from Field.setBoost()?

Thanks, Grant, you're absolutely right.

I stand corrected: Lucene does, in fact, store per-field boosts at 
index-time[1], and then uses them at query-time to score documents.  As Grant 
indicates, the Field.setBoost() method is how to set them.

(It would be nice if Lucene had a facility to set a global field boost for all 
the documents in an index.)

Itamar, the details of how field boosts are used are worth checking out (the 
link below is to the 1.4.3 version):

<http://lucene.apache.org/java/1_4_3/api/org/apache/lucene/document/Field.html#setBoost(float)>

In particular, this part is less than obvious:

    If a document has multiple fields with the same
    name, all such values are multiplied together.

So if you were to add multiple Field instances with the same name to a 
document, as you do in your example, the field boost for the document is the 
*product* of the boosts set on each Field instance added to the document.  One 
way to get around this problem is to call setBoost() just once on each document 
for each of the different field names.  This works because the default boost 
assigned to the other instances is 1.

Steve

[1] It's worth noting, as the above-linked documentation for Field.setBoost() 
does, that field boosts are not stored independently of other normalization 
factors in the index.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to