You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Saksham Gupta <sa...@indiamart.com.INVALID> on 2024/10/15 07:35:17 UTC

java.lang.IllegalStateException on using group.facet=true in solr query

Hi All,

We are using solr 9.6.1 with a collection consisting of 59 shards [one
document might be present on more than one shard]. We are trying to apply
grouping based on suppliers and then apply facet based on one document of
each supplier [although we are fetching more than one].

To achieve this we are using multiple params ilke facet and groups.facet
which is resulting in an error. The parameters used in query are [excluded
basic params like qt and fq]:

"group.field": "usr_id",
"group": "true",
"group.ngroups": "true",
"group.facet": "true"
"facet.field": [
"city",
"CustTypeWt",
"datatype"
]
"facet.limit": "15",
"facet.mincount": "1",
"facet": "true"

We are facing an issue while using *group.facet=true* in solr queries.
Error returned is:

java.lang.IllegalStateException: unexpected docvalues type NUMERIC for
field 'CustTypeWt' (expected=SORTED). Re-index with correct docvalues type.
        at org.apache.lucene.index.DocValues.checkField(DocValues.java:218)
~[?:?]
        at org.apache.lucene.index.DocValues.getSorted(DocValues.java:276)
~[?:?]
        at
org.apache.lucene.search.grouping.TermGroupFacetCollector$SV.doSetNextReader(TermGroupFacetCollector.java:145)
~[?:?]
        at
org.apache.lucene.search.SimpleCollector.getLeafCollector(SimpleCollector.java:31)
~[?:?]
        at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:729) ~[?:?]
        at
org.apache.solr.search.SolrIndexSearcher$4.searchWithTimeout(SolrIndexSearcher.java:729)
~[?:?]
        at
org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:735)
~[?:?]
        at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:552) ~[?:?]
        at
org.apache.solr.request.SimpleFacets.getGroupedCounts(SimpleFacets.java:807)
~[?:?]
        at
org.apache.solr.request.SimpleFacets.getTermCounts(SimpleFacets.java:509)
~[?:?]
        at
org.apache.solr.request.SimpleFacets.getTermCounts(SimpleFacets.java:429)
~[?:?]
        at
org.apache.solr.request.SimpleFacets.lambda$getFacetFieldCounts$0(SimpleFacets.java:915)
~[?:?]
        ... 63 more

The issue is not coming if removing the groups.facet parameter. Any help
with reason/ resolution for this issue will be highly appreciated.

Re: java.lang.IllegalStateException on using group.facet=true in solr query

Posted by Saksham Gupta <sa...@indiamart.com.INVALID>.
Hi Mikhail,

Thanks for chipping in. Will try to do a small rnd by changing the
datatype, although as per my knowledge datatype should not cause this issue
as:

1. We are already applying facet, which works fine, group.facet is failing.

2. A separate underlying docValue type is maintained for fields which have
docValues enabled. For PointFields [as in my case], this type is Numeric
for single-valued fields and Sorted_Numeric for multi-valued fields. The
datatype as per logs is Numeric for my int type, single valued field, which
is correct as per the documentation. Source for this information
<https://solr.apache.org/guide/solr/latest/indexing-guide/docvalues.html#enabling-docvalues>

On Tue, Oct 15, 2024 at 2:08 PM Mikhail Khludnev <mk...@apache.org> wrote:

> Hello. Please find below.
>
> On Tue, Oct 15, 2024 at 10:37 AM Saksham Gupta
> <sa...@indiamart.com.invalid> wrote:
>
> > Hi All,
> >
> > java.lang.IllegalStateException: unexpected docvalues type NUMERIC for
> > field 'CustTypeWt' (expected=SORTED). Re-index with correct docvalues
> type.
> >
>
> It can't handle numbers. Reindex this field as a string or use a string
> copy of this field.
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: java.lang.IllegalStateException on using group.facet=true in solr query

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello. Please find below.

On Tue, Oct 15, 2024 at 10:37 AM Saksham Gupta
<sa...@indiamart.com.invalid> wrote:

> Hi All,
>
> java.lang.IllegalStateException: unexpected docvalues type NUMERIC for
> field 'CustTypeWt' (expected=SORTED). Re-index with correct docvalues type.
>

It can't handle numbers. Reindex this field as a string or use a string
copy of this field.

-- 
Sincerely yours
Mikhail Khludnev