java.lang.IllegalStateException: Type mismatch: ageForIntSorting was indexed with multiple values per document, use SORTED_SET instead

Hibernate JIRA | Sanne Grinovero | 1 year ago
  1. 0

    When using Lucene's {{SortField.Type.INT}} to sort on a field which was not indexed as a NumericField, the resulting error message is confusing: {noformat}java.lang.IllegalStateException: Type mismatch: ageForIntSorting was indexed with multiple values per document, use SORTED_SET instead at org.apache.lucene.uninverting.FieldCacheImpl$SortedDocValuesCache.createValue(FieldCacheImpl.java:679) at org.apache.lucene.uninverting.FieldCacheImpl$Cache.get(FieldCacheImpl.java:190) at org.apache.lucene.uninverting.FieldCacheImpl.getTermsIndex(FieldCacheImpl.java:647) at org.apache.lucene.uninverting.FieldCacheImpl.getTermsIndex(FieldCacheImpl.java:627) at org.apache.lucene.uninverting.UninvertingReader.getSortedDocValues(UninvertingReader.java:257) at org.apache.lucene.index.DocValues.getSorted(DocValues.java:262) at org.apache.lucene.search.FieldComparator$TermOrdValComparator.getSortedDocValues(FieldComparator.java:757) at org.apache.lucene.search.FieldComparator$TermOrdValComparator.getLeafComparator(FieldComparator.java:762) at org.apache.lucene.search.FieldValueHitQueue.getComparators(FieldValueHitQueue.java:183) at org.apache.lucene.search.TopFieldCollector$NonScoringCollector.getLeafCollector(TopFieldCollector.java:141) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:762) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:485) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:473) at org.hibernate.search.query.engine.impl.LazyQueryState.search(LazyQueryState.java:100) at org.hibernate.search.query.engine.impl.QueryHits.updateTopDocs(QueryHits.java:250) at org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:145) at org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:123) at org.hibernate.search.query.engine.impl.HSQueryImpl.getQueryHits(HSQueryImpl.java:447) at org.hibernate.search.query.engine.impl.HSQueryImpl.queryEntityInfos(HSQueryImpl.java:268) {noformat} Wondering if we could improve on that, as this might be a migration issue: it seems previously - before Lucene 5 - this was more lenient (probably gave the wrong sort order, but it would not throw an exception). A starting point it the test {{org.hibernate.search.test.sorting.SortingTest}} (about to be committed). The opposite problem will result in something like: {noformat}java.lang.IllegalStateException: Type mismatch: age was indexed with multiple values per document, use SORTED_SET instead at org.apache.lucene.uninverting.FieldCacheImpl$SortedDocValuesCache.createValue(FieldCacheImpl.java:679) ~[lucene-misc-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:46] at org.apache.lucene.uninverting.FieldCacheImpl$Cache.get(FieldCacheImpl.java:190) ~[lucene-misc-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:46] at org.apache.lucene.uninverting.FieldCacheImpl.getTermsIndex(FieldCacheImpl.java:647) ~[lucene-misc-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:46] at org.apache.lucene.uninverting.FieldCacheImpl.getTermsIndex(FieldCacheImpl.java:627) ~[lucene-misc-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:46] at org.apache.lucene.uninverting.UninvertingReader.getSortedDocValues(UninvertingReader.java:257) ~[lucene-misc-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:46] at org.apache.lucene.index.DocValues.getSorted(DocValues.java:262) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.FieldComparator$TermOrdValComparator.getSortedDocValues(FieldComparator.java:757) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.FieldComparator$TermOrdValComparator.getLeafComparator(FieldComparator.java:762) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.FieldValueHitQueue.getComparators(FieldValueHitQueue.java:183) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.TopFieldCollector$NonScoringCollector.getLeafCollector(TopFieldCollector.java:141) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:762) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:485) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:473) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.hibernate.search.query.engine.impl.LazyQueryState.search(LazyQueryState.java:100) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] at org.hibernate.search.query.engine.impl.QueryHits.updateTopDocs(QueryHits.java:250) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] at org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:145) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] at org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:114) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] at org.hibernate.search.query.engine.impl.HSQueryImpl.getQueryHits(HSQueryImpl.java:452) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] at org.hibernate.search.query.engine.impl.HSQueryImpl.queryEntityInfos(HSQueryImpl.java:268) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] {noformat} I suspect in this case the field was indexed as NumericField, but it's being queried as {{SortField.Type.STRING}}

    Hibernate JIRA | 1 year ago | Sanne Grinovero
    java.lang.IllegalStateException: Type mismatch: ageForIntSorting was indexed with multiple values per document, use SORTED_SET instead
  2. 0

    When using Lucene's {{SortField.Type.INT}} to sort on a field which was not indexed as a NumericField, the resulting error message is confusing: {noformat}java.lang.IllegalStateException: Type mismatch: ageForIntSorting was indexed with multiple values per document, use SORTED_SET instead at org.apache.lucene.uninverting.FieldCacheImpl$SortedDocValuesCache.createValue(FieldCacheImpl.java:679) at org.apache.lucene.uninverting.FieldCacheImpl$Cache.get(FieldCacheImpl.java:190) at org.apache.lucene.uninverting.FieldCacheImpl.getTermsIndex(FieldCacheImpl.java:647) at org.apache.lucene.uninverting.FieldCacheImpl.getTermsIndex(FieldCacheImpl.java:627) at org.apache.lucene.uninverting.UninvertingReader.getSortedDocValues(UninvertingReader.java:257) at org.apache.lucene.index.DocValues.getSorted(DocValues.java:262) at org.apache.lucene.search.FieldComparator$TermOrdValComparator.getSortedDocValues(FieldComparator.java:757) at org.apache.lucene.search.FieldComparator$TermOrdValComparator.getLeafComparator(FieldComparator.java:762) at org.apache.lucene.search.FieldValueHitQueue.getComparators(FieldValueHitQueue.java:183) at org.apache.lucene.search.TopFieldCollector$NonScoringCollector.getLeafCollector(TopFieldCollector.java:141) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:762) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:485) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:473) at org.hibernate.search.query.engine.impl.LazyQueryState.search(LazyQueryState.java:100) at org.hibernate.search.query.engine.impl.QueryHits.updateTopDocs(QueryHits.java:250) at org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:145) at org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:123) at org.hibernate.search.query.engine.impl.HSQueryImpl.getQueryHits(HSQueryImpl.java:447) at org.hibernate.search.query.engine.impl.HSQueryImpl.queryEntityInfos(HSQueryImpl.java:268) {noformat} Wondering if we could improve on that, as this might be a migration issue: it seems previously - before Lucene 5 - this was more lenient (probably gave the wrong sort order, but it would not throw an exception). A starting point it the test {{org.hibernate.search.test.sorting.SortingTest}} (about to be committed). The opposite problem will result in something like: {noformat}java.lang.IllegalStateException: Type mismatch: age was indexed with multiple values per document, use SORTED_SET instead at org.apache.lucene.uninverting.FieldCacheImpl$SortedDocValuesCache.createValue(FieldCacheImpl.java:679) ~[lucene-misc-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:46] at org.apache.lucene.uninverting.FieldCacheImpl$Cache.get(FieldCacheImpl.java:190) ~[lucene-misc-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:46] at org.apache.lucene.uninverting.FieldCacheImpl.getTermsIndex(FieldCacheImpl.java:647) ~[lucene-misc-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:46] at org.apache.lucene.uninverting.FieldCacheImpl.getTermsIndex(FieldCacheImpl.java:627) ~[lucene-misc-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:46] at org.apache.lucene.uninverting.UninvertingReader.getSortedDocValues(UninvertingReader.java:257) ~[lucene-misc-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:46] at org.apache.lucene.index.DocValues.getSorted(DocValues.java:262) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.FieldComparator$TermOrdValComparator.getSortedDocValues(FieldComparator.java:757) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.FieldComparator$TermOrdValComparator.getLeafComparator(FieldComparator.java:762) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.FieldValueHitQueue.getComparators(FieldValueHitQueue.java:183) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.TopFieldCollector$NonScoringCollector.getLeafCollector(TopFieldCollector.java:141) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:762) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:485) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:473) ~[lucene-core-5.2.1.jar:5.2.1 1684708 - shalin - 2015-06-10 23:11:06] at org.hibernate.search.query.engine.impl.LazyQueryState.search(LazyQueryState.java:100) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] at org.hibernate.search.query.engine.impl.QueryHits.updateTopDocs(QueryHits.java:250) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] at org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:145) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] at org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:114) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] at org.hibernate.search.query.engine.impl.HSQueryImpl.getQueryHits(HSQueryImpl.java:452) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] at org.hibernate.search.query.engine.impl.HSQueryImpl.queryEntityInfos(HSQueryImpl.java:268) ~[hibernate-search-engine-5.5.0-SNAPSHOT.jar:5.5.0-SNAPSHOT] {noformat} I suspect in this case the field was indexed as NumericField, but it's being queried as {{SortField.Type.STRING}}

    Hibernate JIRA | 1 year ago | Sanne Grinovero
    java.lang.IllegalStateException: Type mismatch: ageForIntSorting was indexed with multiple values per document, use SORTED_SET instead
  3. 0

    solr datetime sorting is not working

    Stack Overflow | 6 months ago | Dinesh Kumar
    java.lang.IllegalStateException: unexpected docvalues type SORTED_SET for field 'created' (expected=NUMERIC). Use UninvertingReader or index with docvalues.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Numeric sort in Manual (Legacy) index in Neo4j 3 is not working correctly

    Stack Overflow | 7 months ago | rfisher
    java.lang.IllegalStateException: unexpected docvalues type SORTED_SET for field 'firstName' (expected=SORTED). Use UninvertingReader or index with docvalues.
  6. 0

    Numeric sort in Manual (Legacy) index in Neo4j 3 is not working correctly

    GitHub | 6 months ago | rudisb
    java.lang.IllegalStateException: unexpected docvalues type SORTED_SET for field 'firstName' (expected=SORTED). Use UninvertingReader or index with docvalues.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Type mismatch: ageForIntSorting was indexed with multiple values per document, use SORTED_SET instead

      at org.apache.lucene.uninverting.FieldCacheImpl$SortedDocValuesCache.createValue()
    2. org.apache.lucene
      UninvertingReader.getSortedDocValues
      1. org.apache.lucene.uninverting.FieldCacheImpl$SortedDocValuesCache.createValue(FieldCacheImpl.java:679)
      2. org.apache.lucene.uninverting.FieldCacheImpl$Cache.get(FieldCacheImpl.java:190)
      3. org.apache.lucene.uninverting.FieldCacheImpl.getTermsIndex(FieldCacheImpl.java:647)
      4. org.apache.lucene.uninverting.FieldCacheImpl.getTermsIndex(FieldCacheImpl.java:627)
      5. org.apache.lucene.uninverting.UninvertingReader.getSortedDocValues(UninvertingReader.java:257)
      5 frames
    3. Lucene
      IndexSearcher.search
      1. org.apache.lucene.index.DocValues.getSorted(DocValues.java:262)
      2. org.apache.lucene.search.FieldComparator$TermOrdValComparator.getSortedDocValues(FieldComparator.java:757)
      3. org.apache.lucene.search.FieldComparator$TermOrdValComparator.getLeafComparator(FieldComparator.java:762)
      4. org.apache.lucene.search.FieldValueHitQueue.getComparators(FieldValueHitQueue.java:183)
      5. org.apache.lucene.search.TopFieldCollector$NonScoringCollector.getLeafCollector(TopFieldCollector.java:141)
      6. org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:762)
      7. org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:485)
      8. org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:473)
      8 frames
    4. Hibernate Search Engine
      HSQueryImpl.queryEntityInfos
      1. org.hibernate.search.query.engine.impl.LazyQueryState.search(LazyQueryState.java:100)
      2. org.hibernate.search.query.engine.impl.QueryHits.updateTopDocs(QueryHits.java:250)
      3. org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:145)
      4. org.hibernate.search.query.engine.impl.QueryHits.<init>(QueryHits.java:123)
      5. org.hibernate.search.query.engine.impl.HSQueryImpl.getQueryHits(HSQueryImpl.java:447)
      6. org.hibernate.search.query.engine.impl.HSQueryImpl.queryEntityInfos(HSQueryImpl.java:268)
      6 frames