lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Leir <rl...@leirtech.com>
Subject Re: SolrIndexSearcher#getDocList() method returns zero results, if query includes tdate range query
Date Tue, 25 Apr 2017 17:59:00 GMT
Victor,
In SorAdmin, do a query then look at the top bar on the screen. Sorry, I cannot do a screenshot
here. The actual query that SolrAdmin generated is in that top bar. It is difficult to cut
and paste the query but possible. Or you can click on it and jump to a results page. SolrAdmin
has changed over time, I know the 5.5.2 version best.

GetDocList must cause a query to get sent? You could see the query in the logs or even use
Wireshark.
Cheers -- Rick

On April 25, 2017 1:11:25 PM EDT, Victor Solakhian <vsolakhian@gmail.com> wrote:
>Rick,
>
>Solr Admin does not generate a query. I use it just to confirm that the
>query generated by our code returns results.
>
>getDocList() method also does not generate a query, It returns a list
>of
>document IDs for the query created by the QueryParser.parse(query,...).
>method.
>
>Thanks,
>
>Victor
>
>On Tue, Apr 25, 2017 at 12:44 PM, Rick Leir <rleir@leirtech.com> wrote:
>
>> Victor,
>> When you do a query in SolrAdmin, the generated query is shown in at
>the
>> top of the page. Can you compare that with the query that getDocList
>> generates? Or did I misunderstand your question.
>> Cheers -- Rick
>>
>> On April 25, 2017 11:34:17 AM EDT, Victor Solakhian
><vsolakhian@gmail.com>
>> wrote:
>> >We have code that uses *SolrIndexSearcher#getDocList()* method to
>get
>> >document IDs for the query.
>> >
>> >First a Solr query string is generated from UI, then the following
>code
>> >creates a Lucene Query
>> >
>> >  org.apache.lucene.search.Query query =
>parser.parse(solrQueryString);
>> >
>> >where parser is org.apache.lucene.queryparser.classic.QueryParser
>and
>> >then
>> >the following is used to get the document IDs:
>> >
>> >    DocList docList = indexSearcher.getDocList(query, filterList,
>sort,
>> >start, length, 0);
>> >
>> >The code worked perfectly in Solr 4.5. Now, in Solr 5.5.4, it works
>> >only if
>> >the query does not contain a date range query. For example,
>> >solrQueryString:
>> >
>> >"(+c_class:(Industry.government)) AND +valid_date:[2015-10-21 TO
>> >2017-04-21] AND -class:(TitleCodeMiddle.Board) AND +company:[* TO *]
>> >AND
>> >+(has_email:(true) OR has_phone:(true) OR c_has_phone:(true)) AND
>> >+c_class:(Industry.government)"
>> >
>> >was parsed to the Lucene query:
>> >
>> >"+(+c_class:industry.government) +valid_date:[2015-10-21 TO
>2017-04-21]
>> >-class:titlecodemiddle.board +company:[* TO *] +(has_email:T
>> >has_phone:T
>> >c_has_phone:T) +c_class:industry.government"
>> >
>> >which contains "+valid_date:[2015-10-21 TO 2017-04-21]", returns
>ZERO
>> >results, although the same query (actually the Solr equivalent)
>returns
>> >3326 records when used in Solr Admin.
>> >
>> >Here is the definition of the "valid_date" field:
>> >
>> > <field name="valid_date" type="tdate" indexed="true" stored="false"
>/>
>> >
>> >   <fieldType name="tdate" class="solr.TrieDateField"
>> >sortMissingLast="true" precisionStep="6" positionIncrementGap="0"
>> >omitNorms="true"/>
>> >
>> >For a similar query without the range query:
>> >
>> >+(+c_class:industry.government) -class:titlecodemiddle.board
>> >+company:[* TO
>> >*] +(has_email:T has_phone:T c_has_phone:T)
>> >+c_class:industry.government
>> >
>> >our code returns 5629 results (same as Solr Admin).
>> >
>> >I tried to use different formats for date in the Solr query
>(according
>> >to
>> >what I was able to find on the web for Lucene date format):
>> >
>> >   - "+valid_date:[2015-10-21 TO 2017-04-21]"
>> >   - "+valid_date:[20151021 TO 20170421]"
>> >   - "+valid_date:[2015-10-21T04:00:00.000 TO
>2017-04-21T04:00:00.000]"
>> >   - "+valid_date:[2015-10-21T04:00:00.000Z TO
>2017-04-21T04\:00\:00]"
>> >   - "+valid_date:[2015-10-21T00:00:00Z TO 2017-04-21T00:00:00Z]"
>> >
>> >Just out of curiosity, I even generated "+valid_date:[XXX TO XXX]"
>just
>> >to
>> >see that SolrIndexSearcher#getDocList() method does not check for
>> >correct
>> >syntax and returns ZERO results.
>> >
>> >Does anybody know what is happening and what is the proper date
>format
>> >for
>> >Lucene range query in v. 5.5.4?
>> >
>> >Thanks,
>> >
>> >Victor
>>
>> --
>> Sorry for being brief. Alternate email is rickleir at yahoo dot com

-- 
Sorry for being brief. Alternate email is rickleir at yahoo dot com 
Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message