On 12/22/2016 9:21 AM, Roxana Danger wrote:
> 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?

You're writing Lucene code here.  A large part of Solr's purpose is to
avoid the need for Lucene code, so only a fraction of the people on this
list know how to write and troubleshoot Lucene code.  I am not one of them.

You may have better luck with the java-u...@lucene.apache.org mailing
list.  Your question is off-topic for this list.

http://lucene.apache.org/core/discussion.html

Thanks,
Shawn

Reply via email to