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 <rl...@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 <vsolakh...@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