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 2013/04/04 23:14:15 UTC
[jira] [Updated] (SOLR-4676) Share a Lucene FieldType instance
instead of creating on each call to createField()
[ https://issues.apache.org/jira/browse/SOLR-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Smiley updated SOLR-4676:
-------------------------------
Attachment: SOLR-4676_Share_Lucene_FieldType_in_SchemaField.patch
Here is the attached patch. In affected methods I added or enhanced the documentation. In particular, I clarified that createField() (singular) is not for DocValues and that generally createFields() should be called. And I clarified that it can return null.
One inconsistency I found as a side-effect of this is that if a TrieField was docValues enabled, yet not stored nor indexed, createField() would return non-null -- a Field not marked as stored or indexed. That was odd and I changed that. That did mean that in this circumstance there wasn't a Field to call numericValue() on to index DocValues, and so I added stringToNumber() for that. And that is a good segue...
One thing that I think is really bad is the use of switch statements in TrieField to dispatch on the types. Shouldn't a little bit of straight-forward OOP be used to have subclasses do some of these basic things?
> Share a Lucene FieldType instance instead of creating on each call to createField()
> -----------------------------------------------------------------------------------
>
> Key: SOLR-4676
> URL: https://issues.apache.org/jira/browse/SOLR-4676
> Project: Solr
> Issue Type: Improvement
> Components: Schema and Analysis
> Reporter: David Smiley
> Assignee: David Smiley
> Priority: Minor
> Attachments: SOLR-4676_Share_Lucene_FieldType_in_SchemaField.patch
>
>
> I think the Lucene FieldType instances should be cached on Solr's SchemaField so that they don't have to be needlessly re-created for each indexed value that runs through Solr in SchemaField.createField(). The only obstacle I see to this is that getIndexOptions(field,val) takes the value, and if that value were to alter the logic then the FieldType can't be shared. This is a protected method and I don't see anything that overrides it, and the default implementation doesn't use the value. So I think it can be removed. Patch in progress...
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org