Hi, FieldValueQuery reports matches using docvalues, and it looks like they’re not enabled on that field.
Alan Woodward www.flax.co.uk > On 22 Dec 2016, at 16:21, Roxana Danger <roxana.dan...@reedonline.co.uk> > wrote: > > 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.