[ https://issues.apache.org/jira/browse/SOLR-12139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16423110#comment-16423110 ]
Andrey Kudryavtsev commented on SOLR-12139: ------------------------------------------- Have to sacrifice fancy comparator then (and a bit of performance): {code:java} @Override public boolean compare(int doc, FunctionValues lhs, FunctionValues rhs) throws IOException { Object objL = lhs.objectVal(doc); Object objR = rhs.objectVal(doc); if (isInteger(objL) && isInteger(objR)) { return Long.compare(lhs.longVal(doc), rhs.longVal(doc)) == 0; } else if (isNumeric(objL) && isNumeric(objR)) { return Double.compare(lhs.doubleVal(doc), rhs.doubleVal(doc)) == 0; } else { return Objects.equals(objL, objR); } } private static boolean isInteger(Object obj) { return obj instanceof Integer || obj instanceof Long; } private static boolean isNumeric(Object obj) { return obj instanceof Number; } {code} > Support "eq" function for string fields > --------------------------------------- > > Key: SOLR-12139 > URL: https://issues.apache.org/jira/browse/SOLR-12139 > Project: Solr > Issue Type: Improvement > Security Level: Public(Default Security Level. Issues are Public) > Components: search > Reporter: Andrey Kudryavtsev > Assignee: David Smiley > Priority: Minor > Attachments: SOLR-12139.patch, SOLR-12139.patch, SOLR-12139.patch, > SOLR-12139.patch, SOLR-12139.patch, SOLR-12139.patch > > > I just discovered that {{eq}} user function will work for numeric fields only. > For string types it results in {{java.lang.UnsupportedOperationException}} > What do you think if we will extend it to support at least some of string > types as well? -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org