Again, depending on your case, you can use functions in fl to return additional indicator if doc is exact match or not:

q=code_text:bolt OR whatever&fl=*,isExact:tf('code_text_exact', 'bolt')

It will return isExact field with values >0 for any doc that has term 'bolt' in code_text_exact field. Note that I used different field to make sure that term 'bolt' is not in field even document has 'bolter' because of analysis chain.

Regards,
Emir

On 02.03.2017 15:51, Alexandre Rafalovitch wrote:
You could still use scoring with distinct bands of values and include
score field to see the assigned score. Then, on the client, you do
rough grouping.

You could try looking at highlighting, but that's probably
computationally irrational for this purpose.

You could try enabling debugging and see if information present in
there is sufficient.

All of these imply client-side post-processing.

Any other option would be possible only if that keyword was the only
content of the field. Then you could group or facet on it or
something. But not if it is one word of many.

Otherwise, you just do two queries and sort/merge yourself.

Regards,
    Alex.
----
http://www.solr-start.com/ - Resources for Solr users, new and experienced


On 2 March 2017 at 09:09, Сергей Твердохлеб <selik...@gmail.com> wrote:
Hi Emir,

Thanks for your answer.
However in my case I really need to separate results, because I need to
treat those resultsets differently.

Thanks.

2017-03-02 15:57 GMT+02:00 Emir Arnautovic <emir.arnauto...@sematext.com>:

Hi Sergei,

Usually you don't want to know which is which, but you do want to have
exact matches first. In case of simple queries and depending on your
usecase, you can use score to make distinction. If "bolter" matches "bolt"
because of some filters, you will need to index it in two fields and boost
fields differently to get different score for different matches:

code_text_exact:bolt^10000 OR code_text:bolt

If you want to use wildcards, you can use similar approach:

code_text:bolt^10000 OR code_text:bolt*

HTH,
Emir


On 02.03.2017 14:41, Сергей Твердохлеб wrote:

Hi,

is there way to separate exact match from wildcard match in solr response?
e.g. there are two documents: {code_text:bolt} and {code_text:bolter}.
When
I search for "bolt" I want to get both results, but somehow grouped, so I
can determine either it was found with exact or non-exact match.

Thanks.


--
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/



--
Regards,
Sergey Tverdokhleb

--
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/

Reply via email to