[ 
https://issues.apache.org/jira/browse/SOLR-5594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13878055#comment-13878055
 ] 

Hoss Man commented on SOLR-5594:
--------------------------------

Anshum: this all looks great, except for 3 things...

* my point about testing that the querys produced by all the parsers are 
.equals() was about the queries produced by each parser being equal _to each 
other_.  The point is regardless of which parser you use, the resulting queries 
should be the same because we now delegate to the FieldType.  So instead of 
distinct testQuerySimple, testQueryLucene, testQueryPrefix methods each using a 
single parser, we should have a test that shows something like this...{code}
assertQueryEquals(req,
  "{!lucene df=swap_foo_bar_in_prefix_query}foo*",
  "{!simple f=swap_foo_bar_in_prefix_query}foo*",
  "{!prefix f=swap_foo_bar_in_prefix_query}foo",
  ...);
assertQueryEquals(req,
  "{!lucene}int_prefix_as_range:[42 TO *]",
  "{!lucene}int_prefix_as_range:42*",
  "{!simple}int_prefix_as_range:[42 TO *]",
  "{!simple}int_prefix_as_range:42*",
  "{!prefix f=int_prefix_as_range}42",
  ...);
{code}...you see what i mean?
* {{new Random()}} is not allowed - you need to use {{random()}} inherited from 
the test baseclass. you can use "ant precommit" to help spot mistakes like this.
* taking a second look at your assertions about swap_foo_bar_in_prefix_query, i 
don't actually think they are very strong, since (unless i'm missing 
something?) the number of docs containing "foo" prefixes and the number of docs 
containing "bar" prefixes will be the same.  you should change the math so that 
one is less common then the other, and mix in some values that don't match 
either prefix as well.  (ie: let the field be multivalued, and if the id is a 
multiple of 3, add a foo term, if it's a multiple of 7 add a bar term, and if 
it's a multiple of 11 add a zzz term - then assert the expected counts based on 
the total number of docs)


> Enable using extended field types with prefix queries for non-default encoded 
> strings
> -------------------------------------------------------------------------------------
>
>                 Key: SOLR-5594
>                 URL: https://issues.apache.org/jira/browse/SOLR-5594
>             Project: Solr
>          Issue Type: Improvement
>          Components: query parsers, Schema and Analysis
>    Affects Versions: 4.6
>            Reporter: Anshum Gupta
>            Assignee: Anshum Gupta
>            Priority: Minor
>         Attachments: SOLR-5594-branch_4x.patch, SOLR-5594.patch, 
> SOLR-5594.patch, SOLR-5594.patch, SOLR-5594.patch, SOLR-5594.patch
>
>
> Enable users to be able to use prefix query with custom field types with 
> non-default encoding/decoding for queries more easily. e.g. having a custom 
> field work with base64 encoded query strings.
> Currently, the workaround for it is to have the override at getRewriteMethod 
> level. Perhaps having the prefixQuery also use the calling FieldType's 
> readableToIndexed method would work better.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to