You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jan Nehring <ja...@dfki.de> on 2020/09/09 08:38:13 UTC

Unexpected behaviour for bracket

Hi fellow Solr users,

I use Solr in an application for full text search in textual data and I 
spent a lot of time debugging a strange behaviour of Solr. When I search 
for (ABC) then I want results with (ABC) in brackets only. But I get 
results for ABC also, without brackets.

I tried several ways how to formulate the query:

q=rawText:\(ABC)\
q=rawText:"(ABC)"
q=rawText:"\(ABC\)"

But all of them find results for ABC also.

Can you give me a hint why my Solr instance seems to ignore brackets?

Thank you very much Jan


Re: Unexpected behaviour for bracket

Posted by Erick Erickson <er...@gmail.com>.
Places to look:

> add &debug=query to the query and look at the parsed result. Does the parsed version match what you expect? Hint: un-check the “verbose” checkbox, at this level the detailed information probably is just distracting.

> The admin UI>>select_your_core>>analysis page. Put your text in both the “index” and “query” boxes and see what pops out. One thing here that’s often confusing. This is what Solr does with a term _after_ it’s through the parsing process which can fool people. What you enter should be what you see assigned to your field in the parsed query from adding &debug=query above.

> adminUI>>select_your_core>>schema_analysis. Select your field and press the button that loads terms. That’ll show you exactly what’s in your index. The Terms Component let’s you do the same with curl or a browser with more control, see: https://lucene.apache.org/solr/guide/8_5/the-terms-component.html

My bet is that it has nothing to do with your query and everything to do with your analysis chain. For instance, WordDelimiter(Graph)FilterFactory will break the input up by on non-alphanumerics. So what you actually have in your index is the raw ABC. Ditto at query time.

Best,
Erick



> On Sep 9, 2020, at 4:38 AM, Jan Nehring <ja...@dfki.de> wrote:
> 
> Hi fellow Solr users,
> 
> I use Solr in an application for full text search in textual data and I spent a lot of time debugging a strange behaviour of Solr. When I search for (ABC) then I want results with (ABC) in brackets only. But I get results for ABC also, without brackets.
> 
> I tried several ways how to formulate the query:
> 
> q=rawText:\(ABC)\
> q=rawText:"(ABC)"
> q=rawText:"\(ABC\)"
> 
> But all of them find results for ABC also.
> 
> Can you give me a hint why my Solr instance seems to ignore brackets?
> 
> Thank you very much Jan
>