[jira] [Updated] (SOLR-11746) numeric fields need better error handling for prefix/wildcard syntax -- consider uniform support for "foo:* == foo:[* TO *]"

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (SOLR-11746) numeric fields need better error handling for prefix/wildcard syntax -- consider uniform support for "foo:* == foo:[* TO *]"

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/SOLR-11746?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hoss Man updated SOLR-11746:
----------------------------
    Attachment: SOLR-11746.patch

Kai: Thank you for your patch.

I really don't think we should be special casing points fields in the parser like that -- if for no other reason then that it does nothing to fix the bug with docValue only trie fields, or address the concerns about ensuring these 2 syntaxes are functionally equivalent for all types.

What suprised me the most about your patch was realizing that {{SolrQueryParserBase.getWildcardQuery}} is the method getting triggered by the grammer when {{foo:\*}} is parsed -- i assumed it was smart enough to use {{SolrQueryParserBase.getPrefixQuery}} with an empty prefix in this case.

I'm attaching a new patch that:
* makes {{getWildcardQuery}} delegate to {{getPrefixQuery(...,"")}} when the wildcard pattern is {{\*}}
* makes {{FieldType.getPrefixQuery}} smart enough to delegate to {{getRangeQuery(parser, sf,null,null,true,true)}} when the prefix is the empty string
* beefs up the QueryEqualiyTesting to cover more field types
* adds new testing to TestSolrQueryParser to ensure that both syntaxes do what is intended: match all docs that contain the specific field.

I feel like this solution is more robust, and IIUC should even improve the performance of things like StrField and TextField by avoiding the need for an Atomoton that matches all terms

What do folks think of this approach?


> numeric fields need better error handling for prefix/wildcard syntax -- consider uniform support for "foo:* == foo:[* TO *]"
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-11746
>                 URL: https://issues.apache.org/jira/browse/SOLR-11746
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public)
>            Reporter: Hoss Man
>         Attachments: SOLR-11746.patch, SOLR-11746.patch
>
>
> On the solr-user mailing list, Torsten Krah pointed out that with Trie numeric fields, query syntax such as {{foo_d:\*}} has been functionality equivilent to {{foo_d:\[\* TO \*]}} and asked why this was not also supported for Point based numeric fields.
> The fact that this type of syntax works (for {{indexed="true"}} Trie fields) appears to have been an (untested, undocumented) fluke of Trie fields given that they use indexed terms for the (encoded) numeric terms and inherit the default implementation of {{FieldType.getPrefixQuery}} which produces a prefix query against the {{""}} (empty string) term.  
> (Note that this syntax has aparently _*never*_ worked for Trie fields with {{indexed="false" docValues="true"}} )
> In general, we should assess the behavior users attempt a prefix/wildcard syntax query against numeric fields, as currently the behavior is largely non-sensical:  prefix/wildcard syntax frequently match no docs w/o any sort of error, and the aformentioned {{numeric_field:*}} behaves inconsistently between points/trie fields and between indexed/docValued trie fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]