[
https://issues.apache.org/jira/browse/SOLR-10836?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16042848#comment-16042848
]
David Smiley commented on SOLR-10836:
-------------------------------------
Thanks [~gerlowskija]; I've done this same already as part of LUCENE-7500 and
updated some similarly affected QParserPlugins as well.
One problem I see in this code is that it assumes the Terms instance it gets
back is not null. But it can be if the field has no indexed data. This might
in practice not be a big deal but nonetheless it's wrong.
As an aside, I've been using Kotlin Lang on some other projects and I love that
null-ness is part of the type system. It makes bugs like this very rare.
> TextLogisticRegressionQParserPlugin needn't call MultiFields; use
> SolrIndexSearcher's cached instance
> -----------------------------------------------------------------------------------------------------
>
> Key: SOLR-10836
> URL: https://issues.apache.org/jira/browse/SOLR-10836
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: David Smiley
> Priority: Minor
> Attachments: SOLR-10836.patch
>
>
> org.apache.solr.search.TextLogisticRegressionQParserPlugin.TextLogisticRegressionCollector#finish
> contains this line of code:
> {code:java}
> Terms terms =
> MultiFields.getFields(searcher.getIndexReader()).terms(trainingParams.feature);
> {code}
> Instead I think it should be this:
> {code:java}
> Terms terms =
> ((SolrIndexSearcher)searcher).getSlowAtomicReader().terms(trainingParams.feature);
> {code}
> MultiFields can take some time to build and Solr (via SlowAtomicReader) has
> already done this work.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]