lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <>
Subject Re: A very technical question.
Date Wed, 28 Sep 2005 15:09:38 GMT
Field length isn't stored... It gets folded into the norm (see
Similarity.lengthNorm) along with the boost and indexing time.

A couple of approaches:
a) index the field twice with two different Similarity implementations
b) store term vectors, derive the length from them and store in the
FieldCache, implement your own Query/Scorer to factor that in.
c) store a separate length field and use my soon-to-be-finished
(blech, the indentation is messed up in that archive)
d) use FunctionQuery with a custom source that derives field length from
term vectors

(a) Is your best bet right now for a quick solution IMO.

Now hiring --

On 9/28/05, Dawid Weiss <> wrote:
> Hi.
> I have a very technical question. I need to alter document score (or in
> fact: document boosts) for an existing index, but for each query. In
> other words, I'd like these to have pseudo-queries of the form:
> 1. civil war PREFER:shorter
> 2. civil war PREFER:longer
> for these two queries, 1. would score shorter documents higher then
> option 2, which would in turn score longer documents higher. Note that
> these preferences can be expressed at query time, so static document
> boosts are of little help.
> I'd appreciate if those familiar with the internals of Lucene gave me
> brief instructions on how this could be achieved (my rough guess is that
> I'll need to build my own Scorer... but how to access document length
> and where to plug in that scorer... besides I'd rather hear it from
> somebody with more expertise).
> Thanks,
> D.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message