[
https://issues.apache.org/jira/browse/LUCENE-5167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13739555#comment-13739555
]
Ross Woolf commented on LUCENE-5167:
Here is what I tried and it seems to work, but I am only testing on a small set
of data, and I don't fully understand the whole workings of the AtomicReader
process. Please let me know if what I did is valid or not, but I figured since
the AtomicReader is passed to the ExactSimScorer method that I could set things
up there for use in the score method.
I modified SimilarityBase (and other necessary classes) to pass the docId and
rebuilt Lucene.
Then in my class that extends Similarity base I do the following.
{code:title=MySimilarity.java|borderStyle=solid}
public class MySimilarity extends SimilarityBase{
private NumericDocValues values;
...
@Override
public ExactSimScorer exactSimScorer(SimWeight stats, AtomicReaderContext
context) throws IOException {
this.values = context.reader().getNumericDocValues("Scoring");
...
}
@Override
protected float score(BasicStats bs, float f, float f1, int docId) {
long myScore = values.get(docId);
...
}
}
{code}
> SimilarityBase does not pass docId in the score method for use of FieldCache
> or DocValues
> -
>
> Key: LUCENE-5167
> URL: https://issues.apache.org/jira/browse/LUCENE-5167
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/query/scoring
>Affects Versions: 4.0, 4.1, 4.2, 4.4, 4.3.1
>Reporter: Ross Woolf
>
> SimilarityBase does not pass docId in the score method for use of FieldCache
> or DocValues.
> If the intent of extending SimilarityBase is to use a FieldCache or
> NumericDocValuesField as part of the scoring, this is not possible because
> SimilarityBase does not pass on the docId as one of the parameters of the
> score method. This parameter should be added to the score method so that
> fieldCache or NumericDocValues can be used when extending SimilarityBase.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org