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 Derek Poh <dp...@globalsources.com> on 2018/06/12 03:16:27 UTC

How to find out which search terms have matches in a search

Hi

How can I find out which search terms have matches in a search?

Eg.
The search terms are "big brown bear".And only "big" and "brown" have 
matches in the searchresult.
Can Solr return this information that "big" and "brown" have matches in 
the search result?
I want touse this information to display on the search result page that 
"big" and "brown" have matches.
Somethinglike "big brown bear".

Amusing solr 4.10.4.

Derek

----------------------
CONFIDENTIALITY NOTICE 

This e-mail (including any attachments) may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please inform the sender immediately and delete this e-mail (including any attachments) from your computer, and you must not use, disclose to anyone else or copy this e-mail (including any attachments), whether in whole or in part. 

This e-mail and any reply to it may be monitored for security, legal, regulatory compliance and/or other appropriate reasons.

Re: How to find out which search terms have matches in a search

Posted by Derek Poh <dp...@globalsources.com>.
Hi Erik

I have explored the facetquery but it doesnotreally help. Thank you for 
your suggestion.

On 12/6/2018 7:49 PM, Erik Hatcher wrote:
> Derek -
>
> One trick I like to do is try various forms of a query all in one go.   With facet=on, you can:
>
>    &facet.query=big brown bear
>    &facet.query=big brown
>    &facet.query=brown bear
>    &facet.query=big
>    &facet.query=brown
>    &facet.query=bear
>
> The returned counts give you an indication of what queries matched docs in the result set, and which didn’t.   If you did this with q=*:* you’d see how each of those matched across the entire collection.
>
> Grouping and group.query could be used similarly.
>
> I’ve used facet.query to do some Venn diagramming of overlap of search results like that.   An oldie but a goodie: https://www.slideshare.net/lucenerevolution/hatcher-erik-rapid-prototyping-with-solr/12 <https://www.slideshare.net/lucenerevolution/hatcher-erik-rapid-prototyping-with-solr/12>
>
> 4.10.4?   woah
>
> 	Erik Hatcher
> 	Senior Solutions Architect, Lucidworks.com
>
>
>> On Jun 11, 2018, at 11:16 PM, Derek Poh <dp...@globalsources.com> wrote:
>>
>> Hi
>>
>> How can I find out which search terms have matches in a search?
>>
>> Eg.
>> The search terms are "big brown bear".And only "big" and "brown" have matches in the searchresult.
>> Can Solr return this information that "big" and "brown" have matches in the search result?
>> I want touse this information to display on the search result page that "big" and "brown" have matches.
>> Somethinglike "big brown bear".
>>
>> Amusing solr 4.10.4.
>>
>> Derek
>>
>> ----------------------
>> CONFIDENTIALITY NOTICE
>> This e-mail (including any attachments) may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please inform the sender immediately and delete this e-mail (including any attachments) from your computer, and you must not use, disclose to anyone else or copy this e-mail (including any attachments), whether in whole or in part.
>> This e-mail and any reply to it may be monitored for security, legal, regulatory compliance and/or other appropriate reasons.
>


----------------------
CONFIDENTIALITY NOTICE 

This e-mail (including any attachments) may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please inform the sender immediately and delete this e-mail (including any attachments) from your computer, and you must not use, disclose to anyone else or copy this e-mail (including any attachments), whether in whole or in part. 

This e-mail and any reply to it may be monitored for security, legal, regulatory compliance and/or other appropriate reasons.

Re: How to find out which search terms have matches in a search

Posted by Erik Hatcher <er...@gmail.com>.
Derek -

One trick I like to do is try various forms of a query all in one go.   With facet=on, you can:

  &facet.query=big brown bear
  &facet.query=big brown
  &facet.query=brown bear
  &facet.query=big
  &facet.query=brown
  &facet.query=bear

The returned counts give you an indication of what queries matched docs in the result set, and which didn’t.   If you did this with q=*:* you’d see how each of those matched across the entire collection.   

Grouping and group.query could be used similarly.  

I’ve used facet.query to do some Venn diagramming of overlap of search results like that.   An oldie but a goodie: https://www.slideshare.net/lucenerevolution/hatcher-erik-rapid-prototyping-with-solr/12 <https://www.slideshare.net/lucenerevolution/hatcher-erik-rapid-prototyping-with-solr/12>

4.10.4?   woah

	Erik Hatcher
	Senior Solutions Architect, Lucidworks.com


> On Jun 11, 2018, at 11:16 PM, Derek Poh <dp...@globalsources.com> wrote:
> 
> Hi
> 
> How can I find out which search terms have matches in a search?
> 
> Eg.
> The search terms are "big brown bear".And only "big" and "brown" have matches in the searchresult.
> Can Solr return this information that "big" and "brown" have matches in the search result?
> I want touse this information to display on the search result page that "big" and "brown" have matches.
> Somethinglike "big brown bear".
> 
> Amusing solr 4.10.4.
> 
> Derek
> 
> ----------------------
> CONFIDENTIALITY NOTICE 
> This e-mail (including any attachments) may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please inform the sender immediately and delete this e-mail (including any attachments) from your computer, and you must not use, disclose to anyone else or copy this e-mail (including any attachments), whether in whole or in part. 
> This e-mail and any reply to it may be monitored for security, legal, regulatory compliance and/or other appropriate reasons.


Re: How to find out which search terms have matches in a search

Posted by Derek Poh <dp...@globalsources.com>.
Seems like theHighlight feature could help but with some workaround. 
Will need to explore more on it. Thank you.

On 12/6/2018 5:32 PM, Alessandro Benedetti wrote:
> I would recommend to look into the Highlight feature[1] .
> There are few implementations and they should be all right for your user
> requirement.
>
> Regards
>
> [1] https://lucene.apache.org/solr/guide/7_3/highlighting.html
>
>
>
> -----
> ---------------
> Alessandro Benedetti
> Search Consultant, R&D Software Engineer, Director
> Sease Ltd. - www.sease.io
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>
>


----------------------
CONFIDENTIALITY NOTICE 

This e-mail (including any attachments) may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please inform the sender immediately and delete this e-mail (including any attachments) from your computer, and you must not use, disclose to anyone else or copy this e-mail (including any attachments), whether in whole or in part. 

This e-mail and any reply to it may be monitored for security, legal, regulatory compliance and/or other appropriate reasons.

Re: How to find out which search terms have matches in a search

Posted by Alessandro Benedetti <a....@sease.io>.
I would recommend to look into the Highlight feature[1] .
There are few implementations and they should be all right for your user
requirement.

Regards

[1] https://lucene.apache.org/solr/guide/7_3/highlighting.html



-----
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: How to find out which search terms have matches in a search

Posted by Derek Poh <dp...@globalsources.com>.
Sorry I realized the strike through on the term "bear" in "big brown 
bear" cannot be displayaccordinglyin the mailing list.
My aim is to have the search terms "big brown bear", display on the 
search result page with the term "bear" striked through since it does 
not have a match in the search result.


On 12/6/2018 11:16 AM, Derek Poh wrote:
> Hi
>
> How can I find out which search terms have matches in a search?
>
> Eg.
> The search terms are "big brown bear".And only "big" and "brown" have 
> matches in the searchresult.
> Can Solr return this information that "big" and "brown" have matches 
> in the search result?
> I want touse this information to display on the search result page 
> that "big" and "brown" have matches.
> Somethinglike "big brown bear".
>
> Amusing solr 4.10.4.
>
> Derek
>
> ----------------------
> CONFIDENTIALITY NOTICE
> This e-mail (including any attachments) may contain confidential 
> and/or privileged information. If you are not the intended recipient 
> or have received this e-mail in error, please inform the sender 
> immediately and delete this e-mail (including any attachments) from 
> your computer, and you must not use, disclose to anyone else or copy 
> this e-mail (including any attachments), whether in whole or in part.
> This e-mail and any reply to it may be monitored for security, legal, 
> regulatory compliance and/or other appropriate reasons.


----------------------
CONFIDENTIALITY NOTICE 

This e-mail (including any attachments) may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please inform the sender immediately and delete this e-mail (including any attachments) from your computer, and you must not use, disclose to anyone else or copy this e-mail (including any attachments), whether in whole or in part. 

This e-mail and any reply to it may be monitored for security, legal, regulatory compliance and/or other appropriate reasons.