You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Mark S (JIRA)" <ji...@apache.org> on 2013/02/09 16:35:12 UTC

[jira] [Created] (SOLR-4422) SolrJ DocumentObjectBinder class loses Map.Entry order when repopulating dynamic field values, such as @Field("dynamic_field_values*").

Mark S created SOLR-4422:
----------------------------

             Summary: SolrJ DocumentObjectBinder class loses Map.Entry order when repopulating dynamic field values, such as @Field("dynamic_field_values*").
                 Key: SOLR-4422
                 URL: https://issues.apache.org/jira/browse/SOLR-4422
             Project: Solr
          Issue Type: Bug
          Components: clients - java
    Affects Versions: 4.0
            Reporter: Mark S


The SolrJ DocumentObjectBinder class does not retain order when reading in dynamic field values into a Map.  More specifically, the order in which the Map is populated by an application is different to the order in which the Map is repopulated by SolrJ.

----
@Field("dynamic_field_values*")
private Map<String, Object> dynamicFieldValuesMap = new LinkedHashMap<String, Object>(16);

----

I believe the following would address this issue.
-  allValuesMap = new HashMap<String, Object>();
+  allValuesMap = new LinkedHashMap<String, Object>();


Or, maybe the DocumentObjectBinder should directly populate the Map field directly if that field is not null.

----------------

I am pretty sure issue does NOT exist with dynamic field values in a List, as the SolrJ DocumentObjectBinder uses a List implementation that retains ordering "new ArrayList();".  So the following will retain ordering.

@Field("dynamic_field_values_ss")
private List<String> dynamicFieldValues = new ArrayList<String>();


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