Hello, Given that the uninverting type for TextField is SortedSet, the statement in the guide seems inaccurate to me.
On Tue, Jul 19, 2022 at 4:52 AM <eiji.nagay...@rondhuit.com> wrote: > Hi all, > > I found an error and stack trace occurred when I set a 'TextField' type > field to a 'group.field' parameter and got group facets. > According to the manual,we can set 'StrField' or 'TextField' type field to > 'group.field' parameter. > (See > https://solr.apache.org/guide/solr/latest/query-guide/result-grouping.html > ) > So I just tried to set a 'TextField' type field to the 'group.field' > parameter. But the error occured. > > The reproduction procedure using sample_techproducts is as follows. > > 1. Modify solrconfig.xml to show facets. > > - Added 3 lines below the rows parameter > <requestHandler name="/select" class="solr.SearchHandler"> > <lst name="defaults"> > <str name="echoParams">explicit</str> > <int name="rows">10</int> > <str name="facet">on</str> <!-- added -> > <str name="facet.mincount">1</str> <!-- added -> > <str name="facet.limit">-1</str> <!-- added -> > </lst> > > - Removed comments("<!--", "-->") and enabled the following > <lst name="invariants"> > <str name="facet.field">cat</str> > <str name="facet.field">manu_exact</str> > <str name="facet.query">price:[* TO 500]</str> > <str name="facet.query">price:[500 TO *]</str> > </lst> > > 2. Modify managed-schema to define the manu_keyword field. The type of > manu_keyword field is Text.Field using only KeywordTokenizer. > > - Add the following 7 lines just before the "</schema>" > <fieldType name="text_keyword" class="solr.TextField" > positionIncrementGap="100"> > <analyzer> > <tokenizer class="solr.KeywordTokenizerFactory"/> > </analyzer> > </fieldType> > <field name="manu_keyword" type="text_keyword" stored="true" > indexed="true" docValues="false" multiValued="false" /> > <copyField source="manu" dest="manu_keyword"/> > > 3. Indexing(re-index) > > 4. Execute this query > ' > http://localhost:8983/solr/techproducts/select?fl=id,name&q=solr+memory&gro > up=true&group.field=manu_keyword&group.facet=true > <http://localhost:8983/solr/techproducts/select?fl=id,name&q=solr+memory&group=true&group.field=manu_keyword&group.facet=true> > ' > 5. The following error appears. > > "msg":"unexpected docvalues type SORTED_SET for field 'manu_keyword' > (expected=SORTED). Re-index with correct docvalues type.", > "trace":"java.lang.IllegalStateException: unexpected docvalues type > SORTED_SET for field 'manu_keyword' (expected=SORTED). Re-index with > correct > docvalues type. > at org.apache.lucene.index.DocValues.checkField(DocValues.java:218) > ... > > No error occurred when using > ' > http://localhost:8983/solr/techproducts/select?fl=id,name&q=solr+memory&gro > up=true&group.field=manu_exact&group.facet=true > <http://localhost:8983/solr/techproducts/select?fl=id,name&q=solr+memory&group=true&group.field=manu_exact&group.facet=true> > ' > > In addition, even if I re-index, it does not solve. > I guess only 'StrField' type field are allowed in the 'group.field' > parameter. > I have confirmed that this error occurs on Solr 8.11 and Solr 9.0. > > I would be grateful if anyone could give me useful information. > > -- Sincerely yours Mikhail Khludnev