Re: Solr 7.X negative filter not working

2018-09-21 Thread damian.pawski
Hi Yonik Seeley

This is what I am getting, 
for JobTitle: (NOT resources ) I am getting:
/parsed_filter_queries:
parsed_filter_queries:*+(-*JobTitle:resources)/

for -JobTitle:(resources )
  /parsed_filter_queries:
parsed_filter_queries:*-(+*JobTitle:resources)/

so Solr 7.4.1 translates both queries in a different way.

Thank you
Damian



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Solr 7.X negative filter not working

2018-09-20 Thread Yonik Seeley
I just tried the master branch quickly, and I can't reproduce this.

"params":{
  "q":"*:*",
  "debug":"true",
  "fq":"title_t:(NOT Kings)"}},
 [...]
"QParser":"LuceneQParser",
"filter_queries":["title_t:(NOT Kings)"],
"parsed_filter_queries":["-title_t:kings"],

Knowing how the parser works for myfield:(stuff), this is expected (it just
sets the default field to myfield and then parses what's inside the parens
as normal.
So in my example above, all the following parse to the same expression:
-title_t:Kings
NOT title_t:Kings
title_t:(NOT Kings)

Handling pure negative queries currently works at a higher level in Solr
(not the query parser).

Try turning on debug=true and looking at the relevant part of what the
debug info returns.

-Yonik

On Thu, Sep 20, 2018 at 4:05 AM damian.pawski  wrote:

> Hi
> On the Solr 5.4.x below query works fine:
>*
>   
>   "q": "*:*",
>   "_": "1537429094299",
>   "wt": "json",
>   "fq": "JobTitle:(NOT programmer)"
>   ...
> *
>
> , however the same query returns 0 results (I have checked and index
> contains correct data) in the Solr 7.4.1.
>
> I couldn't find anything about this issue in the Solr upgrade pages.
>
> I have tried below query on Solr 7.4.1
>  *
>...
>"q":"*:*",
>"fq":"-JobTitle:programmer"
>...*
> and I am getting correct results.
>
> The problematic search  "JobTitle:(NOT programmer)" is constructed via C#
> code, so I can ont easily update to "-JobTitle".
>
>
> Why the *NOT* query stopped working in the Solr 7.4.1, is there any setting
> that I can switch on to make it work?
>
>
> Thank you
> Damian
>
>
>
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>


Re: Solr 7.X negative filter not working

2018-09-20 Thread damian.pawski
Hi

Thank you for a very quick response and the link :)
Damian



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Solr 7.X negative filter not working

2018-09-20 Thread damian.pawski
Thank you for a very quick response, in that case, I will have to update the
C# to build queries in the "proper" way.



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Solr 7.X negative filter not working

2018-09-20 Thread Shawn Heisey

On 9/20/2018 2:04 AM, damian.pawski wrote:

On the Solr 5.4.x below query works fine:
*
   
   "q": "*:*",
   "_": "1537429094299",
   "wt": "json",
   "fq": "JobTitle:(NOT programmer)"
   ...
 *


I'm surprised this works on any version.

See this page:

https://wiki.apache.org/solr/NegativeQueryProblems


I couldn't find anything about this issue in the Solr upgrade pages.


I would have expected 5.x to behave the same, I am not sure how it is 
working.  As the versions progress, Solr gets more and more strict about 
how it interprets and translates query input, and there's a good chance 
that whatever changed was worded in a way that you'll never know which 
change is the one that made this not work.


Thanks,
Shawn



Re: Solr 7.X negative filter not working

2018-09-20 Thread Till Kinstler

Am 20.09.2018 um 10:04 schrieb damian.pawski:


The problematic search  "JobTitle:(NOT programmer)" is constructed via C#
code, so I can ont easily update to "-JobTitle".


JobTitle:(* NOT programmer) should also work, if that helps...
I think, NOT without left side term was never officially supported. I 
remember reading "Note: The NOT operator cannot be used with just one 
term." already many years ago in the Lucene documentation (in the 
current Lucene release documentation: 
). 
But you are right, it once worked in Solr...


Till

--
Till Kinstler
Verbundzentrale des Gemeinsamen Bibliotheksverbundes (VZG)
Platz der Göttinger Sieben 1, D 37073 Göttingen
kinst...@gbv.de, +49 (0) 551 39-31414, http://www.gbv.de/