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 Salman Ansari <sa...@gmail.com> on 2015/10/15 23:53:50 UTC

Filtering on a Field with Suggestion

Hi guys,

I am working with Solr suggester as explained in this article.
https://cwiki.apache.org/confluence/display/solr/Suggester

The suggester is working fine but I want to filter the results based on a
filed (which is type). I have tried to follow what was written at the end
of the article (about Context Filtering) but still could not get the filter
working.

My Solr configuration for suggestion is

  <searchComponent name="suggest" class="solr.SuggestComponent">
    <lst name="suggester">
    <str name="name">mySuggester</str>
    <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
    <str name="dictionaryImpl">DocumentDictionaryFactory</str>
    <str name="field">entity_autocomplete</str>
    <str name="contextField">type</str>
    <str name="suggestAnalyzerFieldType">text_auto</str>
    <str name="buildOnStartup">false</str>
    </lst>
  </searchComponent>

I have two entries for "Bill Gates" one with type=people and the other with
type=organization.

I have tried the following query but still get both records for suggestion
(The right thing is to get one since I only have one Bill Gates as a type
of organization)

Here is my query

http://
[MySolr]/[MyCollection]/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&suggest.q=Bill&suggest.cfq=people

Any comments why this is not filtering?

Regards,
Salman

Re: Filtering on a Field with Suggestion

Posted by Alessandro Benedetti <ab...@apache.org>.
Yes, as Jan confirmed, I am sure it was not there in 5.3 :)

Cheers

On 16 October 2015 at 12:10, Jan Høydahl <ja...@cominvent.com> wrote:

> Yesm
>
> Context filtering is a new feature in yet-to-be-released Solr5.4.
> So you have to build branch_5x from source yourself to try it out.
>
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
>
> > 16. okt. 2015 kl. 12.35 skrev Salman Ansari <sa...@gmail.com>:
> >
> > Thanks for pointing out as I am using Solr cloud 5.3. However, it looks
> > like they are talking about boolean operation in context field and not
> the
> > support of context field itself. Are you sure that context filtering is
> not
> > supported with any lookup prior to 5.4?
> > On Oct 16, 2015 12:47 PM, "Alessandro Benedetti" <ab...@apache.org>
> > wrote:
> >
> >> This will sound silly, but which version of Solr are you using ?
> >> According to :
> >> https://issues.apache.org/jira/browse/SOLR-7888
> >> This new cool feature will be included in solr 5.4 .
> >>
> >> Cheers
> >>
> >> On 15 October 2015 at 22:53, Salman Ansari <sa...@gmail.com>
> >> wrote:
> >>
> >>> Hi guys,
> >>>
> >>> I am working with Solr suggester as explained in this article.
> >>> https://cwiki.apache.org/confluence/display/solr/Suggester
> >>>
> >>> The suggester is working fine but I want to filter the results based
> on a
> >>> filed (which is type). I have tried to follow what was written at the
> end
> >>> of the article (about Context Filtering) but still could not get the
> >> filter
> >>> working.
> >>>
> >>> My Solr configuration for suggestion is
> >>>
> >>>  <searchComponent name="suggest" class="solr.SuggestComponent">
> >>>    <lst name="suggester">
> >>>    <str name="name">mySuggester</str>
> >>>    <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
> >>>    <str name="dictionaryImpl">DocumentDictionaryFactory</str>
> >>>    <str name="field">entity_autocomplete</str>
> >>>    <str name="contextField">type</str>
> >>>    <str name="suggestAnalyzerFieldType">text_auto</str>
> >>>    <str name="buildOnStartup">false</str>
> >>>    </lst>
> >>>  </searchComponent>
> >>>
> >>> I have two entries for "Bill Gates" one with type=people and the other
> >> with
> >>> type=organization.
> >>>
> >>> I have tried the following query but still get both records for
> >> suggestion
> >>> (The right thing is to get one since I only have one Bill Gates as a
> type
> >>> of organization)
> >>>
> >>> Here is my query
> >>>
> >>> http://
> >>>
> >>>
> >>
> [MySolr]/[MyCollection]/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&suggest.q=Bill&suggest.cfq=people
> >>>
> >>> Any comments why this is not filtering?
> >>>
> >>> Regards,
> >>> Salman
> >>>
> >>
> >>
> >>
> >> --
> >> --------------------------
> >>
> >> Benedetti Alessandro
> >> Visiting card : http://about.me/alessandro_benedetti
> >>
> >> "Tyger, tyger burning bright
> >> In the forests of the night,
> >> What immortal hand or eye
> >> Could frame thy fearful symmetry?"
> >>
> >> William Blake - Songs of Experience -1794 England
> >>
>
>


-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Filtering on a Field with Suggestion

Posted by Jan Høydahl <ja...@cominvent.com>.
Yesm

Context filtering is a new feature in yet-to-be-released Solr5.4. 
So you have to build branch_5x from source yourself to try it out.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

> 16. okt. 2015 kl. 12.35 skrev Salman Ansari <sa...@gmail.com>:
> 
> Thanks for pointing out as I am using Solr cloud 5.3. However, it looks
> like they are talking about boolean operation in context field and not the
> support of context field itself. Are you sure that context filtering is not
> supported with any lookup prior to 5.4?
> On Oct 16, 2015 12:47 PM, "Alessandro Benedetti" <ab...@apache.org>
> wrote:
> 
>> This will sound silly, but which version of Solr are you using ?
>> According to :
>> https://issues.apache.org/jira/browse/SOLR-7888
>> This new cool feature will be included in solr 5.4 .
>> 
>> Cheers
>> 
>> On 15 October 2015 at 22:53, Salman Ansari <sa...@gmail.com>
>> wrote:
>> 
>>> Hi guys,
>>> 
>>> I am working with Solr suggester as explained in this article.
>>> https://cwiki.apache.org/confluence/display/solr/Suggester
>>> 
>>> The suggester is working fine but I want to filter the results based on a
>>> filed (which is type). I have tried to follow what was written at the end
>>> of the article (about Context Filtering) but still could not get the
>> filter
>>> working.
>>> 
>>> My Solr configuration for suggestion is
>>> 
>>>  <searchComponent name="suggest" class="solr.SuggestComponent">
>>>    <lst name="suggester">
>>>    <str name="name">mySuggester</str>
>>>    <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
>>>    <str name="dictionaryImpl">DocumentDictionaryFactory</str>
>>>    <str name="field">entity_autocomplete</str>
>>>    <str name="contextField">type</str>
>>>    <str name="suggestAnalyzerFieldType">text_auto</str>
>>>    <str name="buildOnStartup">false</str>
>>>    </lst>
>>>  </searchComponent>
>>> 
>>> I have two entries for "Bill Gates" one with type=people and the other
>> with
>>> type=organization.
>>> 
>>> I have tried the following query but still get both records for
>> suggestion
>>> (The right thing is to get one since I only have one Bill Gates as a type
>>> of organization)
>>> 
>>> Here is my query
>>> 
>>> http://
>>> 
>>> 
>> [MySolr]/[MyCollection]/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&suggest.q=Bill&suggest.cfq=people
>>> 
>>> Any comments why this is not filtering?
>>> 
>>> Regards,
>>> Salman
>>> 
>> 
>> 
>> 
>> --
>> --------------------------
>> 
>> Benedetti Alessandro
>> Visiting card : http://about.me/alessandro_benedetti
>> 
>> "Tyger, tyger burning bright
>> In the forests of the night,
>> What immortal hand or eye
>> Could frame thy fearful symmetry?"
>> 
>> William Blake - Songs of Experience -1794 England
>> 


Re: Filtering on a Field with Suggestion

Posted by Salman Ansari <sa...@gmail.com>.
Thanks for pointing out as I am using Solr cloud 5.3. However, it looks
like they are talking about boolean operation in context field and not the
support of context field itself. Are you sure that context filtering is not
supported with any lookup prior to 5.4?
On Oct 16, 2015 12:47 PM, "Alessandro Benedetti" <ab...@apache.org>
wrote:

> This will sound silly, but which version of Solr are you using ?
> According to :
> https://issues.apache.org/jira/browse/SOLR-7888
> This new cool feature will be included in solr 5.4 .
>
> Cheers
>
> On 15 October 2015 at 22:53, Salman Ansari <sa...@gmail.com>
> wrote:
>
> > Hi guys,
> >
> > I am working with Solr suggester as explained in this article.
> > https://cwiki.apache.org/confluence/display/solr/Suggester
> >
> > The suggester is working fine but I want to filter the results based on a
> > filed (which is type). I have tried to follow what was written at the end
> > of the article (about Context Filtering) but still could not get the
> filter
> > working.
> >
> > My Solr configuration for suggestion is
> >
> >   <searchComponent name="suggest" class="solr.SuggestComponent">
> >     <lst name="suggester">
> >     <str name="name">mySuggester</str>
> >     <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
> >     <str name="dictionaryImpl">DocumentDictionaryFactory</str>
> >     <str name="field">entity_autocomplete</str>
> >     <str name="contextField">type</str>
> >     <str name="suggestAnalyzerFieldType">text_auto</str>
> >     <str name="buildOnStartup">false</str>
> >     </lst>
> >   </searchComponent>
> >
> > I have two entries for "Bill Gates" one with type=people and the other
> with
> > type=organization.
> >
> > I have tried the following query but still get both records for
> suggestion
> > (The right thing is to get one since I only have one Bill Gates as a type
> > of organization)
> >
> > Here is my query
> >
> > http://
> >
> >
> [MySolr]/[MyCollection]/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&suggest.q=Bill&suggest.cfq=people
> >
> > Any comments why this is not filtering?
> >
> > Regards,
> > Salman
> >
>
>
>
> --
> --------------------------
>
> Benedetti Alessandro
> Visiting card : http://about.me/alessandro_benedetti
>
> "Tyger, tyger burning bright
> In the forests of the night,
> What immortal hand or eye
> Could frame thy fearful symmetry?"
>
> William Blake - Songs of Experience -1794 England
>

Re: Filtering on a Field with Suggestion

Posted by Alessandro Benedetti <ab...@apache.org>.
This will sound silly, but which version of Solr are you using ?
According to :
https://issues.apache.org/jira/browse/SOLR-7888
This new cool feature will be included in solr 5.4 .

Cheers

On 15 October 2015 at 22:53, Salman Ansari <sa...@gmail.com> wrote:

> Hi guys,
>
> I am working with Solr suggester as explained in this article.
> https://cwiki.apache.org/confluence/display/solr/Suggester
>
> The suggester is working fine but I want to filter the results based on a
> filed (which is type). I have tried to follow what was written at the end
> of the article (about Context Filtering) but still could not get the filter
> working.
>
> My Solr configuration for suggestion is
>
>   <searchComponent name="suggest" class="solr.SuggestComponent">
>     <lst name="suggester">
>     <str name="name">mySuggester</str>
>     <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
>     <str name="dictionaryImpl">DocumentDictionaryFactory</str>
>     <str name="field">entity_autocomplete</str>
>     <str name="contextField">type</str>
>     <str name="suggestAnalyzerFieldType">text_auto</str>
>     <str name="buildOnStartup">false</str>
>     </lst>
>   </searchComponent>
>
> I have two entries for "Bill Gates" one with type=people and the other with
> type=organization.
>
> I have tried the following query but still get both records for suggestion
> (The right thing is to get one since I only have one Bill Gates as a type
> of organization)
>
> Here is my query
>
> http://
>
> [MySolr]/[MyCollection]/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&suggest.q=Bill&suggest.cfq=people
>
> Any comments why this is not filtering?
>
> Regards,
> Salman
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England