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/03/02 05:39:12 UTC

[jira] [Updated] (SOLR-4329) Have DocumentBuilder give value collections to the FieldType

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

David Smiley updated SOLR-4329:
-------------------------------

    Attachment: DocumentBuilder.java

DocumentBuilder, at least today, is used entirely via DocumentBuilder.toDocument(...) (a static method) -- yet there are a bunch of old instance methods, fields, and constructor that are unused and thus only complicates what is going on.  The attached replacement for review removes all the old cruft, and refactors the code to use field instance state. I found that handy because I added a new optional FieldType interface "DocumentBuilderAware" with one method addFieldsToDocument(DocumentBuilder, boost) that takes the DocumentBuilder and can then access various state via getters.

The main use-case why I want this extension point is to add a single DocValues field to the Lucene document that has a byte array representation of each value the field will get (its multi-valued).

Another use-case is when the field value is pre-parsed from an URP or never was a string (EmbeddedSolrServer or perhaps DIH even), yet the value happens to implement Collection (e.g. a Spatial4j ShapeCollection).  This ShapeCollection needs to be seen by the FieldType yet the current DocumentBuilder will instead separately hand the FieldType each component shape value.

There are undoubtedly other creative use-cases (certainly non-spatial).  With access to the entire SolrInputDocument, a FieldType might want to look at another particular field to include it in some way.  Yet I can understand that tying FieldType to DocumentBuilder could be seen as a less than clean backwards dependency and so this is an optional interface.

(the attached is the entire file because it was modified so heavily that a patch would be unintelligible)

Comments please!
                
> Have DocumentBuilder give value collections to the FieldType
> ------------------------------------------------------------
>
>                 Key: SOLR-4329
>                 URL: https://issues.apache.org/jira/browse/SOLR-4329
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>            Reporter: David Smiley
>         Attachments: DocumentBuilder.java
>
>
> I'd like to write a multi-value-configured FieldType that can return a DocValue Field from its createFields().  Since DocValues holds a single value per document for a field, you can only have one.  However FieldType.createFields() is invoked by the DocumentBuilder once per each value being indexed.
> FYI the reason I'm asking for this is for a multi-valued spatial field to store its points in DocValues.

--
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