lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slly <sll...@126.com>
Subject Re:Re: Use boolean operator "-", the result is incorrect
Date Wed, 08 Apr 2020 09:53:53 GMT
My default query operator is OR.There are two pieces of data in the index:
{ "id":"1", "name_s":"a", "age_i":10, "_version_":1663396766955864064}, { "id":"2", "name_s":"b",
"age_i":10, "_version_":1663396767058624512}] }


  1.   -name_s:a OR age_i:10          # I think two pieces of data should be returned, but
only one

"rawquerystring":"-name_s:a age_i:10", "querystring":"-name_s:a age_i:10", "parsedquery":"-name_s:a
IndexOrDocValuesQuery(age_i:[10 TO 10])", "parsedquery_toString":"-name_s:a age_i:[10 TO 10]",
"QParser":"LuceneQParser",



  2.  id:("1" "2") AND (-name_s:a) # I think one data should be returned, but 0 data 

"rawquerystring":"id:(\"1\" \"2\") AND (-name_s:a)", "querystring":"id:(\"1\" \"2\") AND (-name_s:a)",
"parsedquery":"+(id:1 id:2) +(-name_s:a)", "parsedquery_toString":"+(id:1 id:2) +(-name_s:a)",
"QParser":"LuceneQParser",





At 2020-04-08 17:46:37, "Bernd Fehling" <bernd.fehling@uni-bielefeld.de> wrote:
>What is debugQuery telling you about:
>- "rawquerystring"
>- "querystring"
>- "parsedquery"
>- "parsedquery_toString"
>- "QParser"
>
>Also what is your default query operator, AND or OR?
>This is what matters for your second example with  id:("1" "2")
>It could be  id:("1" AND "2")  or  id:("1" OR "2") .
>
>Regards
>Bernd
>
>Am 08.04.20 um 11:30 schrieb slly:
>> Thanks Bernd for your reply.
>>  I run the query on the Solr Web UI in Solr 7.3.1/7.7.2, the screenshot of my execution
results is as follows,  I don't understand whether there is a grammatical error ?
>> 1. -name_s:a OR age_i:10
>> 
>> 2. id:("1" "2") AND (-name_s:a)
>> 
>> 
>> At 2020-04-08 16:33:20, "Bernd Fehling" <bernd.fehling@uni-bielefeld.de> wrote:
>>> Looks correct to me.
>>>
>>> You have to obey the level of the operators and the parenthesis.
>>> Turn debugQuery on to see the results of parsing of your query.
>>>
>>> Regards
>>> Bernd
>>>
>>> Am 08.04.20 um 09:34 schrieb slly:
>>>>
>>>>
>>>> If the following query is executed, the result is different:
>>>>
>>>>
>>>> id:("1" "2") AND (-name_s:a)     --> numFound is 0 
>>>>
>>>>
>>>> id:("1" "2") AND -(name_s:a)    --> numFound is 1 
>>>>
>>>>
>>>>
>>>> At 2020-04-08 14:56:26, "slly" <sllyjw@126.com> wrote:
>>>>> Hello Folks,
>>>>> We are using Solr 7.3.1,  I write the following two lines of data into
collection:
>>>>> id, name_s, age_i
>>>>> 1, a, 10
>>>>> 2, b, 10
>>>>> Use the following query syntax:
>>>>> -name_s:a OR age_i:10
>>>>>
>>>>>
>>>>> I think we should return two pieces of data, but actually only one piece
of data:
>>>>> id, name_s, age_i
>>>>> 2, b, 10
>>>>>
>>>>>
>>>>> Did I get it wrong?  Looking forward to some valuable suggestions. Thanks.
>> 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message