lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Woodward <a...@flax.co.uk>
Subject Re: problem executing a query using lucene directly
Date Thu, 22 Dec 2016 21:58:04 GMT
Solr wraps its IndexReader in an UninvertingReader, which builds doc-values structures in memory
if required.  If you include the solr jar file on your classpath, you should be able to use
UninvertingReader.wrap() to do something similar.

Alan Woodward
www.flax.co.uk


> On 22 Dec 2016, at 17:58, Roxana Danger <roxana.danger@reedonline.co.uk> wrote:
> 
> Hi Alan,
> thank you very much, but I am not sure if this is the reason.
> 
> but if I use the solrSearcher, FieldValueQuery works well, using the same
> index.
> If SolrIndexSearcher enable this feature, how does it do it?
> 
> Thank you again!
> 
> 
> 
> 
> On 22 December 2016 at 17:34, Alan Woodward <alan@flax.co.uk> wrote:
> 
>> 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.danger@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.
>> 
>> 
> 
> 
> -- 
> Roxana Danger | Senior Data Scientist
> Dragon Court, 27-29 Macklin Street, London, WC2B 5LX
> Tel: 020 7067 4568   Ext:
> [image: reed.co.uk] <http://www.reed.co.uk/>
> The UK's #1 job site. <http://www.reed.co.uk/>
> [image: Follow us on Twitter] <https://twitter.com/reedcouk>
> <https://www.linkedin.com/company/reed-co-uk> [image: Like us on Facebook]
> <https://www.facebook.com/reedcouk/>
> <https://plus.google.com/u/0/+reedcouk/posts>
> It's time to Love Mondays » <http://www.reed.co.uk/lovemondays>
> 
> -- 
> 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