I also got this exception before and in order to avoid reindexing TB's of data, 
had to resort to grouping via streaming expressions, which has its ups and 
downs. If it's technically infeasible to substitute docValues for this purpose 
(when useDocValuesAsStored:true), it would be nice if it was documented in 
"grouping" feature or advised in general schema design pages to make unique 
ID's always stored:true.

-ufuk yilmaz
________________________________
From: rajani m <rajinima...@gmail.com>
Sent: Wednesday, February 7, 2024 3:18 AM
To: solr-user <solr-u...@lucene.apache.org>
Subject: Group by query reports null pointer when unique key is not stored

Hi Solr Users,

  Group by query is failing with the following error message. It looks like
TopGroupsResultTransformer.java
<https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/search/grouping/distributed/shardresultserializer/TopGroupsResultTransformer.java#L237C24-L237C40>
retrieveDocument method is fetching doc based on id is calling a stored
field visitor method. I tried setting the "id" field to use doc values as
they are enabled "useDocValuesAsStored:true" but this didn't help. Any
alternative?

Would you call this a bug or improvement?

Error message -

java.lang.NullPointerException: Cannot invoke
"org.apache.lucene.index.IndexableField.stringValue()" because "f" is
null => java.lang.NullPointerException: Cannot invoke
"org.apache.lucene.index.IndexableField.stringValue()" because "f" is
null
        at org.apache.solr.schema.FieldType.toExternal(FieldType.java:378)
java.lang.NullPointerException: Cannot invoke
"org.apache.lucene.index.IndexableField.stringValue()" because "f" is
null
        at org.apache.solr.schema.FieldType.toExternal(FieldType.java:378) 
~[?:?]
        at 
org.apache.solr.search.grouping.distributed.shardresultserializer.TopGroupsResultTransformer.serializeTopGroups(TopGroupsResultTransformer.java:238)
~[?:?]

Reply via email to