lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roxana Danger <roxana.dan...@reedonline.co.uk>
Subject problem executing a query using lucene directly
Date Thu, 22 Dec 2016 16:47:41 GMT
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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message