You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Hoss Man (JIRA)" <ji...@apache.org> on 2017/04/04 01:17:42 UTC

[jira] [Updated] (SOLR-10400) refactor "instanceof TrieFooField || instanceof FooPointsField" to use "FooValueFieldType" marker interface

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

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


bq. ...we already have the NumericValueFieldType marker interface and children.

Actually, even better then using that marker interface we should just be using FieldType.getNumberType which saves us the need for reflection calls -- particularly the repeated calls currently done in several "if else if else if else" contexts where ultimately the code was trying to do a "switch" like statement over the types of numerics -- and now (in the attached patch) using FieldType.getNumberType: it can.

The attached patch fixes up the 3 places i found the "instanceof TrieFooField || instanceof FooPointsField" pattern...

* CollapsingQParserPlugin
* ExpandComponent
* DocumentExpressionDictionaryFactory
** this last one had an even simpler fix then using "getNumberType" -- ultimately it just wanted "getSortField()"

As things stand, there are a few nocommits in the patch because I'm concerned about some edge cases that were ignored in the "instanceof" code that should probably throw errors.

A bigger concern I have however is that i don't think there is enough test coverage of these code paths (particularly using points fields) for me to feel comfortable committing these changes until i have a chance to write some more tests. (I don't *think* they break anything not currently broken, but i'd like to be more confident that the current code isn't broken before i refactor it)



> refactor "instanceof TrieFooField || instanceof FooPointsField" to use "FooValueFieldType" marker interface
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-10400
>                 URL: https://issues.apache.org/jira/browse/SOLR-10400
>             Project: Solr
>          Issue Type: Sub-task
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Hoss Man
>         Attachments: SOLR-10400.patch
>
>
> See previous comment from smiley in SOLR-9994...
> https://issues.apache.org/jira/browse/SOLR-9994?focusedCommentId=15875390&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15875390
> ...we already have the NumericValueFieldType marker interface and children.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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