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

Mark S updated SOLR-4422:
-------------------------

    Description: 
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>();


  was:
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>();


    
> 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-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to