Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-4422

SolrJ DocumentObjectBinder class loses Map.Entry order when repopulating dynamic field values, such as @Field("dynamic_field_values*").

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.0
    • None
    • clients - java, SolrJ
    • None

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            marks1900 Mark S
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: