java.lang.IllegalArgumentException: field="rating" was indexed with numDims=0 but this query has numDims=1

Apache's JIRA Issue Tracker | Ishan Chattopadhyaya | 10 months ago
  1. 0

    As I was trying out dimensional fields for SOLR-8396, I realized that DimensionalRangeQuery is not working with UninvertingReader. In Solr, all directory readers are wrapped by an UninvertingReader and an ExitableDirectoryReader. Here's the error: {code} Exception in thread "main" java.lang.IllegalArgumentException: field="rating" was indexed with numDims=0 but this query has numDims=1 at$1.scorer( at at at at at at at DimensionalRangeQueryExample.query( {code} Here's an example program to trigger this failure: {code} import; import java.util.HashMap; import java.util.Map; import java.util.Random; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.DimensionalIntField; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Store; import org.apache.lucene.document.LegacyIntField; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.StoredDocument; import org.apache.lucene.queryparser.classic.ParseException; import; import; import; import; import; import; import; import; import org.apache.lucene.uninverting.UninvertingReader; import org.apache.lucene.util.BytesRef; public class DimensionalRangeQueryExample { public static void main(String[] args) throws IOException, ParseException { StandardAnalyzer analyzer = new StandardAnalyzer(); Directory index = new RAMDirectory(); IndexWriterConfig config = new IndexWriterConfig(analyzer); IndexWriter w = new IndexWriter(index, config); addDoc(w, "Lucene in Action", 1); addDoc(w, "Lucene for Dummies", 2); addDoc(w, "Managing Gigabytes", 3); addDoc(w, "The Art of Computer Science", 4); w.commit(); w.close(); DirectoryReader reader = (; Map<String, UninvertingReader.Type> uninvertingMap = new HashMap<>(); uninvertingMap.put("id", UninvertingReader.Type.BINARY); uninvertingMap.put("rating", UninvertingReader.Type.INTEGER); reader = UninvertingReader.wrap(reader, uninvertingMap); IndexSearcher searcher = new IndexSearcher(reader); Query legacyQuery = LegacyNumericRangeQuery.newIntRange("rating_legacy", 1, 4, true, true); Query dimensionalQuery = DimensionalRangeQuery.new1DIntRange("rating", 1, true, 4, true); System.out.println("Legacy query: "); query(legacyQuery, searcher); // works System.out.println("Dimensional query: "); query(dimensionalQuery, searcher); // fails reader.close(); } private static void query(Query q, IndexSearcher searcher) throws IOException { int hitsPerPage = 10; TopDocs docs =, hitsPerPage); ScoreDoc[] hits = docs.scoreDocs; System.out.println("Found " + hits.length + " hits."); for(int i=0;i<hits.length;++i) { int docId = hits[i].doc; StoredDocument d = searcher.doc(docId); System.out.println((i + 1) + ". " + d); } } private static void addDoc(IndexWriter w, String title, int rating) throws IOException { Document doc = new Document(); String id = ""+new Random().nextInt(1000); byte idBytes[] = id.getBytes(); doc.add(new StringField("id", new BytesRef(idBytes), Store.YES)); doc.add(new TextField("title", title, Field.Store.YES)); doc.add(new DimensionalIntField("rating", rating)); LegacyIntField legacy = new LegacyIntField("rating_legacy", rating, Store.YES); legacy.setIntValue(rating); doc.add(legacy); w.addDocument(doc); } } {code} I don't yet know more as to why this could be. [~mikemccand] Any ideas, please? Apologies if I should've brought this up in the mailing lists, or as a comment in LUCENE-6917 itself.

    Apache's JIRA Issue Tracker | 10 months ago | Ishan Chattopadhyaya
    java.lang.IllegalArgumentException: field="rating" was indexed with numDims=0 but this query has numDims=1
  2. 0

    Extension talk:Lucene-search/archive/2009 - MediaWiki | 3 months ago
    java.lang.IllegalArgumentException: nDocs must be > 0
  3. 0

    Publishing project to Modeshape repo in JBDS 4.0 beta1 - Unhandled event loop exception | 6 years ago | Len DiMaggio
    java.lang.IllegalArgumentException: Internationalization field "serverManagerGetWorkspacesExceptionMsg" in class 0 parameters supplied, but 1 parameter required: "There was a problem obtaining workspaces for "{0}."" => "There was a problem obtaining workspaces for "{0}"
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0


    Oracle Community | 1 decade ago | 3004
    java.lang.IllegalArgumentException: Illegal attempt to assign a removed bean to a CMR field. The EJB with primary key '32531' has been removed and cannot be assigned to this CMR field.
  6. 0

    java.lang.IllegalArgumentException: factor < 0; was: -1

    Apache Bugzilla | 5 years ago | mathieu.malaterre
    java.lang.IllegalArgumentException: factor < 0; was: -1

    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.IllegalArgumentException

      field="rating" was indexed with numDims=0 but this query has numDims=1

    2. Lucene
      7 frames
    3. Unknown
      1. DimensionalRangeQueryExample.query(
      1 frame