lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Duncan Jr <>
Subject Customizing Field Score (Multivalued Field)
Date Tue, 03 Nov 2009 16:22:04 GMT
We've had a customized score calculator for one of our fields that we
developed when we were using Lucene instead of Solr (lucene 2.4).  During
our switch to Solr, we simply continued to use that code.  However, as the
version of Lucene used in Solr changed to 2.9, somewhere along the way
(unfortunately during our last release of code), that customization broke.
I'd previously tried to keep it up to date by dealing with deprecation
warnings, but managed to break things.  Now I'm pretty lost with regards to
that code.

Our customization is conceptually pretty simple, so rather than try to fix
up our code, I'd like some advice on the best way to implement this with
Solr 2.4 starting fresh.

We have a multi-valued field, where each value is basically the id of a
category.  Along with the id, there's a score for how well the document fit
into that category (between 0.0 and 1.0).  I'm looking for that
category-score to affect the score of documents when searching on that
field.  Any suggestions on the best way to attack this in Solr 2.4?

Here's how we did it in Lucene: we had an extension of Query, with a custom
scorer.   In the index we stored the category id's as single-valued
space-separated string.  We also stored a space-separated string of scores
in another field.  We made of these fields stored.  We simply delegated the
search to the normal searcher, then we calculated the score we retrieved the
values of both fields for the document.  Then we turned the space-separated
strings into arrays, searched the id array for the index of the desired id,
then scanned the score array for the matching score, and returned.

Stephen Duncan Jr

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