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 Zheng Lin Edwin Yeo <ed...@gmail.com> on 2017/07/19 10:33:06 UTC

Returning unique values for suggestion

Hi,

Is there any configuration that we can set for the /suggest handler, so
that the suggestion output will only return unique records, and not
duplicated?

Below is my /suggest handler.

  <requestHandler name="/suggest" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">all</str>
   <str name="wt">json</str>
   <str name="indent">true</str>
<str name="df">content</str>
<str name="rows">100</str>
<str name="fl">id, score</str>
  <str name="hl">on</str>
  <str name="hl.fl">content</str>
  <str name="hl.highlightMultiTerm">true</str>
  <str name="hl.preserveMulti">false</str>
  <str name="hl.encoder">html</str>
  <str name="hl.fragsize">100</str>
    <str name="hl.maxAnalyzedChars">204800</str>
  <str name="hl.usePhraseHighlighter">true</str>
</lst>

Regards,
Edwin

Re: Returning unique values for suggestion

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Hi Walter,

Can we consider this as a bug/improvement for the /suggest handler which
uses highlighter?

Regards,
Edwin

On 20 July 2017 at 10:14, Zheng Lin Edwin Yeo <ed...@gmail.com> wrote:

> I am getting something similar to yours too, but I'm using Solr 6.5.1.
>
>
>   "highlighting":{
>     "00001":{
>       "content":["Incoming <em>Call</em>"]},
>     "00002":{
>       "content":["Incoming <em>Call</em>"]},
>     "00003":{
>       "content":["Outgoing <em>Call</em>"]},
>     "00004":{
>       "content":["Outgoing <em>Call</em>"]},
>
> Regards,
> Edwin
>
>
> On 19 July 2017 at 22:21, Walter Underwood <wu...@wunderwood.org> wrote:
>
>> I was surprised to see duplicate suggestions coming from my 4.10.4
>> suggester. This is analyzing infix with terms loaded from the index.
>>
>> "titles_infix": {
>> "chemistry": {
>> "numFound": 10,
>> "suggestions": [
>> {
>> "term": "<b>Chemistry</b>",
>> "weight": 5285,
>> "payload": ""
>> },
>> {
>> "term": "<b>Chemistry</b>",
>> "weight": 4548,
>> "payload": ""
>> },
>> {
>> "term": "<b>Chemistry</b>",
>> "weight": 3002,
>> "payload": ""
>> },
>> {
>> "term": "Introductory <b>Chemistry</b>",
>> "weight": 2823,
>> "payload": ""
>> },
>>
>>
>> wunder
>> Walter Underwood
>> wunder@wunderwood.org
>> http://observer.wunderwood.org/  (my blog)
>>
>>
>> > On Jul 19, 2017, at 3:33 AM, Zheng Lin Edwin Yeo <ed...@gmail.com>
>> wrote:
>> >
>> > Hi,
>> >
>> > Is there any configuration that we can set for the /suggest handler, so
>> > that the suggestion output will only return unique records, and not
>> > duplicated?
>> >
>> > Below is my /suggest handler.
>> >
>> >  <requestHandler name="/suggest" class="solr.SearchHandler">
>> > <lst name="defaults">
>> > <str name="echoParams">all</str>
>> >   <str name="wt">json</str>
>> >   <str name="indent">true</str>
>> > <str name="df">content</str>
>> > <str name="rows">100</str>
>> > <str name="fl">id, score</str>
>> >  <str name="hl">on</str>
>> >  <str name="hl.fl">content</str>
>> >  <str name="hl.highlightMultiTerm">true</str>
>> >  <str name="hl.preserveMulti">false</str>
>> >  <str name="hl.encoder">html</str>
>> >  <str name="hl.fragsize">100</str>
>> >    <str name="hl.maxAnalyzedChars">204800</str>
>> >  <str name="hl.usePhraseHighlighter">true</str>
>> > </lst>
>> >
>> > Regards,
>> > Edwin
>>
>>
>

Re: Returning unique values for suggestion

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
I am getting something similar to yours too, but I'm using Solr 6.5.1.


  "highlighting":{
    "00001":{
      "content":["Incoming <em>Call</em>"]},
    "00002":{
      "content":["Incoming <em>Call</em>"]},
    "00003":{
      "content":["Outgoing <em>Call</em>"]},
    "00004":{
      "content":["Outgoing <em>Call</em>"]},

Regards,
Edwin


On 19 July 2017 at 22:21, Walter Underwood <wu...@wunderwood.org> wrote:

> I was surprised to see duplicate suggestions coming from my 4.10.4
> suggester. This is analyzing infix with terms loaded from the index.
>
> "titles_infix": {
> "chemistry": {
> "numFound": 10,
> "suggestions": [
> {
> "term": "<b>Chemistry</b>",
> "weight": 5285,
> "payload": ""
> },
> {
> "term": "<b>Chemistry</b>",
> "weight": 4548,
> "payload": ""
> },
> {
> "term": "<b>Chemistry</b>",
> "weight": 3002,
> "payload": ""
> },
> {
> "term": "Introductory <b>Chemistry</b>",
> "weight": 2823,
> "payload": ""
> },
>
>
> wunder
> Walter Underwood
> wunder@wunderwood.org
> http://observer.wunderwood.org/  (my blog)
>
>
> > On Jul 19, 2017, at 3:33 AM, Zheng Lin Edwin Yeo <ed...@gmail.com>
> wrote:
> >
> > Hi,
> >
> > Is there any configuration that we can set for the /suggest handler, so
> > that the suggestion output will only return unique records, and not
> > duplicated?
> >
> > Below is my /suggest handler.
> >
> >  <requestHandler name="/suggest" class="solr.SearchHandler">
> > <lst name="defaults">
> > <str name="echoParams">all</str>
> >   <str name="wt">json</str>
> >   <str name="indent">true</str>
> > <str name="df">content</str>
> > <str name="rows">100</str>
> > <str name="fl">id, score</str>
> >  <str name="hl">on</str>
> >  <str name="hl.fl">content</str>
> >  <str name="hl.highlightMultiTerm">true</str>
> >  <str name="hl.preserveMulti">false</str>
> >  <str name="hl.encoder">html</str>
> >  <str name="hl.fragsize">100</str>
> >    <str name="hl.maxAnalyzedChars">204800</str>
> >  <str name="hl.usePhraseHighlighter">true</str>
> > </lst>
> >
> > Regards,
> > Edwin
>
>

Re: Returning unique values for suggestion

Posted by Walter Underwood <wu...@wunderwood.org>.
I was surprised to see duplicate suggestions coming from my 4.10.4 suggester. This is analyzing infix with terms loaded from the index.

"titles_infix": {
"chemistry": {
"numFound": 10,
"suggestions": [
{
"term": "<b>Chemistry</b>",
"weight": 5285,
"payload": ""
},
{
"term": "<b>Chemistry</b>",
"weight": 4548,
"payload": ""
},
{
"term": "<b>Chemistry</b>",
"weight": 3002,
"payload": ""
},
{
"term": "Introductory <b>Chemistry</b>",
"weight": 2823,
"payload": ""
},


wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)


> On Jul 19, 2017, at 3:33 AM, Zheng Lin Edwin Yeo <ed...@gmail.com> wrote:
> 
> Hi,
> 
> Is there any configuration that we can set for the /suggest handler, so
> that the suggestion output will only return unique records, and not
> duplicated?
> 
> Below is my /suggest handler.
> 
>  <requestHandler name="/suggest" class="solr.SearchHandler">
> <lst name="defaults">
> <str name="echoParams">all</str>
>   <str name="wt">json</str>
>   <str name="indent">true</str>
> <str name="df">content</str>
> <str name="rows">100</str>
> <str name="fl">id, score</str>
>  <str name="hl">on</str>
>  <str name="hl.fl">content</str>
>  <str name="hl.highlightMultiTerm">true</str>
>  <str name="hl.preserveMulti">false</str>
>  <str name="hl.encoder">html</str>
>  <str name="hl.fragsize">100</str>
>    <str name="hl.maxAnalyzedChars">204800</str>
>  <str name="hl.usePhraseHighlighter">true</str>
> </lst>
> 
> Regards,
> Edwin