Search code examples
jsonxmlsolrschemasolrnet

solr result grouping error unexpected docvalues type sorted set for field "recentjobtitlecopy"(expected=SORTED)


I am new to solr and wanted to implement document grouping.I am using solr 6.1 version.I have a schema.xml with fields like this :

<field indexed="true" name="recentjobtitle" omitNorms="false" omitTermFreqAndPositions="false" stored="true" termOffsets="true" termPositions="true" termVectors="true" type="text_general"/>
<field docValues="false" indexed="true" name="recentjobtitlecopy" omitNorms="false" omitTermFreqAndPositions="false" stored="false" termOffsets="true" termPositions="true" termVectors="true" type="string_ci"/> 

Here, "recentjobtitle" is a tokenized field so to get the grouped results, I used "recentjobtitlecopy" field.

<copyField dest="recentjobtitlecopy" source="recentjobtitle"/>

Now, when i ran the group query like this:

group=true&group.field=recentjobtitlecopy&group.limit=10

I got this exception:solr result grouping error unexpected docvalues type sorted set for field "recentjobtitlecopy"(expected=SORTED).

I even tried to remove "docValues" property on "recentjobtitlecopy" field, performed re-indexing via the Data Import Handler console. Still, the exception was the same.

Strangely, the same code works on my local machine(with and without docValues) solr setup, but throws the exception on a hosted environment(multiple shards here). Can anyone please point out if I am missing something or doing something wrong?


Solution

  • Use the string as fieldType for your field named recentjobtitlecopy

    Do not use the multivalued for your field.

    Your field definition would look like below. This is a simple definition of your field. You can add additional attributes as required.

    <field name="recentjobtitlecopy" type="string" indexed="true" docValues="false" omitNorms="false" stored="false"/>