You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "David Smiley (JIRA)" <ji...@apache.org> on 2015/09/01 22:34:46 UTC
[jira] [Commented] (SOLR-8001) Using value sources on a
multi-valued field can result in an exception if no data
[ https://issues.apache.org/jira/browse/SOLR-8001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14726130#comment-14726130 ]
David Smiley commented on SOLR-8001:
------------------------------------
I don't have a complete patch with proper assertions but I triggered the bug by editing {{TestMinMaxOnMultiValuedField}} to have a test method like so:
{code:java}
assertU(adoc(sdoc("id", "0")));//nothing
assertU(commit());
assertQ(req("q", "*:*",
"sort", "sum(32,field(val_tls_dv,min)) asc"),
"//TODO");
{code}
> Using value sources on a multi-valued field can result in an exception if no data
> ---------------------------------------------------------------------------------
>
> Key: SOLR-8001
> URL: https://issues.apache.org/jira/browse/SOLR-8001
> Project: Solr
> Issue Type: Bug
> Reporter: David Smiley
> Priority: Minor
>
> SOLR-2522 Introduced the ability to reference a multi-valued field with doc values in a function query (value source) such as like this (an example using it for sorting): {{sort=field(myMultiValField,min) asc}}. In the event that the document has no values for this field, this feature behaves nicely in the aforementioned example. And it does if you reference in a 'fl' (as a DocTransformer): {{fl=id,myMultiValField:field(myMultiValField,min)}}. In that case, the returned document simply doesn't have a name-value pair. *But*, if you sort on a more complex function that incorporates this, then you get an ArrayIndexOutOfBoundsException. Such as this:
> {{sort=sum(otherField,field(myMultiValField,min)) asc}} There may be other conditions where this same exception will be thrown; not sure.
> The root cause can either be considered one of two things (or both) I think:
> * The longVal, intVal, etc. methods on FunctionValues need to be prepared for the possibility that the document has no data, in which case it should return a default value. This means TrieLongField (& friends) are erroneous.
> * ValueSource.ValueSourceComparator could/should (?) call {{exists}} before calling {{doubleVal}} in the various methods where it does.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org