This does not work because FieldValueQuery requires that the field has doc values, which is not the case on your field apparently.
Le jeu. 22 déc. 2016 à 17:50, Roxana Danger <roxana.dan...@reedonline.co.uk> a écrit : > Hi all, > > I have created an index using solr. I am trying to execute the following > code, but I get zero results in the count. > > DirectoryReader dr = DirectoryReader.open(FSDirectory.open(new > File(indexDir).toPath())); > IndexSearcher searcher = new IndexSearcher( dr ); > > System.out.println(dr.maxDoc()); // Shows 2000000 > Query query = new FieldValueQuery("table"); > CollectionStatistics stats = searcher.collectionStatistics("table"); > System.out.println(stats.docCount()); // Shows 2000000 > > System.out.println(searcher.count(query)); //Shows 0, should be 2000000 > > The definition of the table filed in the schema.xml is: > > <field name="table" type="string" indexed="true" stored="true" > required="true" multiValued="false"/> > > Any idea, why this could be happening? Why the search with the > FieldValueQuery is not returning the correct result? > > Thank you very much in advance. > > -- > Reed Online Ltd is a company registered in England and Wales. Company > Registration Number: 6317279. > Registered Office: Academy Court, 94 Chancery Lane, London WC2A 1DT. >