lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: Using stored fields for scoring
Date Fri, 09 May 2008 14:32:49 GMT
Well, all things are possible <G>.... But I don't think there's a way to get
the field from each document at scoring time efficiently. It looks like
you're already lazy-loading the field, which was going to be my suggestion.

You could get it much faster if you *did* index it (UN_TOKENIZED?) and
went after it with TermDocs/TermEnum.....

So what is the nature of the field you're using? Is it possible to build
up the list of doc<->binaryfield at, say, startup time and just use a
map or some such?

You could even think about putting all the binary data in your
 index in a special document that had a field(s) orthogonal to
all other document. Essentially take the map I suggested
earlier and stuff it in a doc with one field (say,
"MySpecialMapField"). Then read *that* document in
at startup (or even search time) to get your binary field for

All this pre-supposes that your binary field/doc_id map will fit
in memory....

What about index-time boosting? This only does you good
if your binary data above is some sort of importance ranking.
Index time boosting says something like "This document title
is more important than normal" so this would *automatically*
affect your scoring. You'd have to apply the index-time boosts
selectively to the fields you want....

And if none of this is relevant, could you expand a bit more on what
you're trying to do? What is the nature and purpose of your
field you want to use to influence scoring?


On Fri, May 9, 2008 at 10:07 AM, Paolo Capriotti <>

> Hi all,
> I am looking for a way to include a stored (non-indexed) field in the
> computation of scores for a query.
> I have tried using a ValueSourceQuery with a ValueSource subclass that
> simply retrieves the document and gets the field, like:
> public float floatVal(int doc) {
>  reader.document(doc, selector).getBinaryValue("myfield");
>  ....
> }
> but that's too slow, because it ends up doing a lookup for each matching
> document.
> Is it possible to use a stored field in a FunctionQuery or ValueSourceQuery
> in an efficient way (i.e. not dependent on the number of retrieved
> documents)?
> If the answer is yes, is it possible to update such a value in place
> without removing and reindexing the document?
> Thanks in advance.
> Paolo Capriotti
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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