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 Lasitha Wattaladeniya <wa...@gmail.com> on 2016/05/11 14:05:12 UTC

Dynamically change solr suggest field

Hello devs,

I'm trying to implement auto complete text suggestions using solr. I have a
text box and next to that there's a combo box. So the auto complete should
suggest based on the value selected in the combo box.

Basically I should be able to change the suggest field based on the value
selected in the combo box. I was trying to solve this problem whole day but
not much luck. Can anybody tell me is there a way of doing this ?

Regards,
Lasitha.

Lasitha Wattaladeniya
Software Engineer

Mobile : +6593896893
Blog : techreadme.blogspot.com

Re: Dynamically change solr suggest field

Posted by Lasitha Wattaladeniya <wa...@gmail.com>.
Hi Alessandro,

Yes, using suggester is the correct way of doing. But in our scenario we
thought of going with the spellchecker component since we had some legacy
setup. Our plan is to move to suggester later on.

So far spellchecker component also does the needed work for us.

Regards,
Lasitha

Lasitha Wattaladeniya
Software Engineer

Mobile : +6593896893
Blog : techreadme.blogspot.com

On Tue, May 17, 2016 at 2:15 AM, Alessandro Benedetti <
benedetti.alex85@gmail.com> wrote:

> The scenario you described should be done with the suggester component.
> Nothing prevent you to configure multiple dictionaries for the suggester as
> well.
> The you pass the dictionary to the suggester at query time as a request
> parameter for your suggester request handler.
>
> Cheers
> On 16 May 2016 4:29 pm, "Abdel Belkasri" <be...@gmail.com> wrote:
>
> > Clever and real cool.
> > --Abdel
> >
> > On Sun, May 15, 2016 at 10:42 AM, Lasitha Wattaladeniya <
> wattale@gmail.com
> > >
> > wrote:
> >
> > > Hello all,
> > >
> > > I found a way of doing this and thought of sharing this info with you.
> I
> > > found a way to dynamically change the field which gives the
> suggestions.
> > > It's using the solr spellchecker (Not suggester). You can basically
> > > configure a  indexed field as default *spellcheck.dictionary* in the
> > config
> > > file. Later you can set what ever the field you want suggestions from
> in
> > > the request (Can set more than 1) as the spellcheck.dictionary. This
> way
> > > you can set even multiple fields as spellchecker dictionaries and
> > > suggestions will be returned according to the indexed values of those
> > > field.
> > >
> > > Regards,
> > > Lasitha.
> > >
> > > Lasitha Wattaladeniya
> > > Software Engineer
> > >
> > > Mobile : +6593896893
> > > Blog : techreadme.blogspot.com
> > >
> > > On Thu, May 12, 2016 at 8:05 AM, Lasitha Wattaladeniya <
> > wattale@gmail.com>
> > > wrote:
> > >
> > > > Hi Nick,
> > > >
> > > > Thanks for the reply. According to my requirement I can use only
> option
> > > > one. I thought about that solution but I was bit lazy to implement
> that
> > > > since I have many modules and solr cores. If I'm going to configure
> > > request
> > > > handlers for each drop down value in each component it seems like a
> lot
> > > of
> > > > work. Anyway this seems like the only way forward.
> > > >
> > > > I can't use the option two because the combo box select the filed,
> not
> > a
> > > > value specific to a single field
> > > >
> > > > Best regards,
> > > > Lasitha
> > > >
> > > > Lasitha Wattaladeniya
> > > > Software Engineer
> > > >
> > > > Mobile : +6593896893
> > > > Blog : techreadme.blogspot.com
> > > >
> > > > On Wed, May 11, 2016 at 11:41 PM, Nick D <nd...@gmail.com>
> wrote:
> > > >
> > > >> There are only two ways I can think of to accomplish this and
> neither
> > of
> > > >> them are dynamically setting the suggester field as is looks
> according
> > > to
> > > >> the Doc (which does sometimes have lacking info so I might be wrong)
> > you
> > > >> cannot set something like *suggest.fl=combo_box_field* at query
> time.
> > > But
> > > >> maybe they can help you get started.
> > > >>
> > > >> 1. Multiple suggester request handlers for each option in combo box.
> > > This
> > > >> way you just change the request handler in the query you submit
> based
> > on
> > > >> the context.
> > > >>
> > > >> 2. Use copy fields to put all possible suggestions into same field
> > name,
> > > >> so
> > > >> no more dynamic field settings, with another field defining whatever
> > the
> > > >> option would be for that document out of the combo box and use
> context
> > > >> filters which can be passed at query time to limit the suggestions
> to
> > > >> those
> > > >> filtered by whats in the combo box.
> > > >>
> > > >>
> > >
> >
> https://cwiki.apache.org/confluence/display/solr/Suggester#Suggester-ContextFiltering
> > > >>
> > > >> Hope this helps a bit
> > > >>
> > > >> Nick
> > > >>
> > > >> On Wed, May 11, 2016 at 7:05 AM, Lasitha Wattaladeniya <
> > > wattale@gmail.com
> > > >> >
> > > >> wrote:
> > > >>
> > > >> > Hello devs,
> > > >> >
> > > >> > I'm trying to implement auto complete text suggestions using
> solr. I
> > > >> have a
> > > >> > text box and next to that there's a combo box. So the auto
> complete
> > > >> should
> > > >> > suggest based on the value selected in the combo box.
> > > >> >
> > > >> > Basically I should be able to change the suggest field based on
> the
> > > >> value
> > > >> > selected in the combo box. I was trying to solve this problem
> whole
> > > day
> > > >> but
> > > >> > not much luck. Can anybody tell me is there a way of doing this ?
> > > >> >
> > > >> > Regards,
> > > >> > Lasitha.
> > > >> >
> > > >> > Lasitha Wattaladeniya
> > > >> > Software Engineer
> > > >> >
> > > >> > Mobile : +6593896893
> > > >> > Blog : techreadme.blogspot.com
> > > >> >
> > > >>
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Abdel K. Belkasri, PhD
> >
>

Re: Dynamically change solr suggest field

Posted by Alessandro Benedetti <be...@gmail.com>.
The scenario you described should be done with the suggester component.
Nothing prevent you to configure multiple dictionaries for the suggester as
well.
The you pass the dictionary to the suggester at query time as a request
parameter for your suggester request handler.

Cheers
On 16 May 2016 4:29 pm, "Abdel Belkasri" <be...@gmail.com> wrote:

> Clever and real cool.
> --Abdel
>
> On Sun, May 15, 2016 at 10:42 AM, Lasitha Wattaladeniya <wattale@gmail.com
> >
> wrote:
>
> > Hello all,
> >
> > I found a way of doing this and thought of sharing this info with you. I
> > found a way to dynamically change the field which gives the suggestions.
> > It's using the solr spellchecker (Not suggester). You can basically
> > configure a  indexed field as default *spellcheck.dictionary* in the
> config
> > file. Later you can set what ever the field you want suggestions from in
> > the request (Can set more than 1) as the spellcheck.dictionary. This way
> > you can set even multiple fields as spellchecker dictionaries and
> > suggestions will be returned according to the indexed values of those
> > field.
> >
> > Regards,
> > Lasitha.
> >
> > Lasitha Wattaladeniya
> > Software Engineer
> >
> > Mobile : +6593896893
> > Blog : techreadme.blogspot.com
> >
> > On Thu, May 12, 2016 at 8:05 AM, Lasitha Wattaladeniya <
> wattale@gmail.com>
> > wrote:
> >
> > > Hi Nick,
> > >
> > > Thanks for the reply. According to my requirement I can use only option
> > > one. I thought about that solution but I was bit lazy to implement that
> > > since I have many modules and solr cores. If I'm going to configure
> > request
> > > handlers for each drop down value in each component it seems like a lot
> > of
> > > work. Anyway this seems like the only way forward.
> > >
> > > I can't use the option two because the combo box select the filed, not
> a
> > > value specific to a single field
> > >
> > > Best regards,
> > > Lasitha
> > >
> > > Lasitha Wattaladeniya
> > > Software Engineer
> > >
> > > Mobile : +6593896893
> > > Blog : techreadme.blogspot.com
> > >
> > > On Wed, May 11, 2016 at 11:41 PM, Nick D <nd...@gmail.com> wrote:
> > >
> > >> There are only two ways I can think of to accomplish this and neither
> of
> > >> them are dynamically setting the suggester field as is looks according
> > to
> > >> the Doc (which does sometimes have lacking info so I might be wrong)
> you
> > >> cannot set something like *suggest.fl=combo_box_field* at query time.
> > But
> > >> maybe they can help you get started.
> > >>
> > >> 1. Multiple suggester request handlers for each option in combo box.
> > This
> > >> way you just change the request handler in the query you submit based
> on
> > >> the context.
> > >>
> > >> 2. Use copy fields to put all possible suggestions into same field
> name,
> > >> so
> > >> no more dynamic field settings, with another field defining whatever
> the
> > >> option would be for that document out of the combo box and use context
> > >> filters which can be passed at query time to limit the suggestions to
> > >> those
> > >> filtered by whats in the combo box.
> > >>
> > >>
> >
> https://cwiki.apache.org/confluence/display/solr/Suggester#Suggester-ContextFiltering
> > >>
> > >> Hope this helps a bit
> > >>
> > >> Nick
> > >>
> > >> On Wed, May 11, 2016 at 7:05 AM, Lasitha Wattaladeniya <
> > wattale@gmail.com
> > >> >
> > >> wrote:
> > >>
> > >> > Hello devs,
> > >> >
> > >> > I'm trying to implement auto complete text suggestions using solr. I
> > >> have a
> > >> > text box and next to that there's a combo box. So the auto complete
> > >> should
> > >> > suggest based on the value selected in the combo box.
> > >> >
> > >> > Basically I should be able to change the suggest field based on the
> > >> value
> > >> > selected in the combo box. I was trying to solve this problem whole
> > day
> > >> but
> > >> > not much luck. Can anybody tell me is there a way of doing this ?
> > >> >
> > >> > Regards,
> > >> > Lasitha.
> > >> >
> > >> > Lasitha Wattaladeniya
> > >> > Software Engineer
> > >> >
> > >> > Mobile : +6593896893
> > >> > Blog : techreadme.blogspot.com
> > >> >
> > >>
> > >
> > >
> >
>
>
>
> --
> Abdel K. Belkasri, PhD
>

Re: Dynamically change solr suggest field

Posted by Abdel Belkasri <be...@gmail.com>.
Clever and real cool.
--Abdel

On Sun, May 15, 2016 at 10:42 AM, Lasitha Wattaladeniya <wa...@gmail.com>
wrote:

> Hello all,
>
> I found a way of doing this and thought of sharing this info with you. I
> found a way to dynamically change the field which gives the suggestions.
> It's using the solr spellchecker (Not suggester). You can basically
> configure a  indexed field as default *spellcheck.dictionary* in the config
> file. Later you can set what ever the field you want suggestions from in
> the request (Can set more than 1) as the spellcheck.dictionary. This way
> you can set even multiple fields as spellchecker dictionaries and
> suggestions will be returned according to the indexed values of those
> field.
>
> Regards,
> Lasitha.
>
> Lasitha Wattaladeniya
> Software Engineer
>
> Mobile : +6593896893
> Blog : techreadme.blogspot.com
>
> On Thu, May 12, 2016 at 8:05 AM, Lasitha Wattaladeniya <wa...@gmail.com>
> wrote:
>
> > Hi Nick,
> >
> > Thanks for the reply. According to my requirement I can use only option
> > one. I thought about that solution but I was bit lazy to implement that
> > since I have many modules and solr cores. If I'm going to configure
> request
> > handlers for each drop down value in each component it seems like a lot
> of
> > work. Anyway this seems like the only way forward.
> >
> > I can't use the option two because the combo box select the filed, not a
> > value specific to a single field
> >
> > Best regards,
> > Lasitha
> >
> > Lasitha Wattaladeniya
> > Software Engineer
> >
> > Mobile : +6593896893
> > Blog : techreadme.blogspot.com
> >
> > On Wed, May 11, 2016 at 11:41 PM, Nick D <nd...@gmail.com> wrote:
> >
> >> There are only two ways I can think of to accomplish this and neither of
> >> them are dynamically setting the suggester field as is looks according
> to
> >> the Doc (which does sometimes have lacking info so I might be wrong) you
> >> cannot set something like *suggest.fl=combo_box_field* at query time.
> But
> >> maybe they can help you get started.
> >>
> >> 1. Multiple suggester request handlers for each option in combo box.
> This
> >> way you just change the request handler in the query you submit based on
> >> the context.
> >>
> >> 2. Use copy fields to put all possible suggestions into same field name,
> >> so
> >> no more dynamic field settings, with another field defining whatever the
> >> option would be for that document out of the combo box and use context
> >> filters which can be passed at query time to limit the suggestions to
> >> those
> >> filtered by whats in the combo box.
> >>
> >>
> https://cwiki.apache.org/confluence/display/solr/Suggester#Suggester-ContextFiltering
> >>
> >> Hope this helps a bit
> >>
> >> Nick
> >>
> >> On Wed, May 11, 2016 at 7:05 AM, Lasitha Wattaladeniya <
> wattale@gmail.com
> >> >
> >> wrote:
> >>
> >> > Hello devs,
> >> >
> >> > I'm trying to implement auto complete text suggestions using solr. I
> >> have a
> >> > text box and next to that there's a combo box. So the auto complete
> >> should
> >> > suggest based on the value selected in the combo box.
> >> >
> >> > Basically I should be able to change the suggest field based on the
> >> value
> >> > selected in the combo box. I was trying to solve this problem whole
> day
> >> but
> >> > not much luck. Can anybody tell me is there a way of doing this ?
> >> >
> >> > Regards,
> >> > Lasitha.
> >> >
> >> > Lasitha Wattaladeniya
> >> > Software Engineer
> >> >
> >> > Mobile : +6593896893
> >> > Blog : techreadme.blogspot.com
> >> >
> >>
> >
> >
>



-- 
Abdel K. Belkasri, PhD

Re: Dynamically change solr suggest field

Posted by Lasitha Wattaladeniya <wa...@gmail.com>.
Hello all,

I found a way of doing this and thought of sharing this info with you. I
found a way to dynamically change the field which gives the suggestions.
It's using the solr spellchecker (Not suggester). You can basically
configure a  indexed field as default *spellcheck.dictionary* in the config
file. Later you can set what ever the field you want suggestions from in
the request (Can set more than 1) as the spellcheck.dictionary. This way
you can set even multiple fields as spellchecker dictionaries and
suggestions will be returned according to the indexed values of those
field.

Regards,
Lasitha.

Lasitha Wattaladeniya
Software Engineer

Mobile : +6593896893
Blog : techreadme.blogspot.com

On Thu, May 12, 2016 at 8:05 AM, Lasitha Wattaladeniya <wa...@gmail.com>
wrote:

> Hi Nick,
>
> Thanks for the reply. According to my requirement I can use only option
> one. I thought about that solution but I was bit lazy to implement that
> since I have many modules and solr cores. If I'm going to configure request
> handlers for each drop down value in each component it seems like a lot of
> work. Anyway this seems like the only way forward.
>
> I can't use the option two because the combo box select the filed, not a
> value specific to a single field
>
> Best regards,
> Lasitha
>
> Lasitha Wattaladeniya
> Software Engineer
>
> Mobile : +6593896893
> Blog : techreadme.blogspot.com
>
> On Wed, May 11, 2016 at 11:41 PM, Nick D <nd...@gmail.com> wrote:
>
>> There are only two ways I can think of to accomplish this and neither of
>> them are dynamically setting the suggester field as is looks according to
>> the Doc (which does sometimes have lacking info so I might be wrong) you
>> cannot set something like *suggest.fl=combo_box_field* at query time. But
>> maybe they can help you get started.
>>
>> 1. Multiple suggester request handlers for each option in combo box. This
>> way you just change the request handler in the query you submit based on
>> the context.
>>
>> 2. Use copy fields to put all possible suggestions into same field name,
>> so
>> no more dynamic field settings, with another field defining whatever the
>> option would be for that document out of the combo box and use context
>> filters which can be passed at query time to limit the suggestions to
>> those
>> filtered by whats in the combo box.
>>
>> https://cwiki.apache.org/confluence/display/solr/Suggester#Suggester-ContextFiltering
>>
>> Hope this helps a bit
>>
>> Nick
>>
>> On Wed, May 11, 2016 at 7:05 AM, Lasitha Wattaladeniya <wattale@gmail.com
>> >
>> wrote:
>>
>> > Hello devs,
>> >
>> > I'm trying to implement auto complete text suggestions using solr. I
>> have a
>> > text box and next to that there's a combo box. So the auto complete
>> should
>> > suggest based on the value selected in the combo box.
>> >
>> > Basically I should be able to change the suggest field based on the
>> value
>> > selected in the combo box. I was trying to solve this problem whole day
>> but
>> > not much luck. Can anybody tell me is there a way of doing this ?
>> >
>> > Regards,
>> > Lasitha.
>> >
>> > Lasitha Wattaladeniya
>> > Software Engineer
>> >
>> > Mobile : +6593896893
>> > Blog : techreadme.blogspot.com
>> >
>>
>
>

Re: Dynamically change solr suggest field

Posted by Lasitha Wattaladeniya <wa...@gmail.com>.
Hi Nick,

Thanks for the reply. According to my requirement I can use only option
one. I thought about that solution but I was bit lazy to implement that
since I have many modules and solr cores. If I'm going to configure request
handlers for each drop down value in each component it seems like a lot of
work. Anyway this seems like the only way forward.

I can't use the option two because the combo box select the filed, not a
value specific to a single field

Best regards,
Lasitha

Lasitha Wattaladeniya
Software Engineer

Mobile : +6593896893
Blog : techreadme.blogspot.com

On Wed, May 11, 2016 at 11:41 PM, Nick D <nd...@gmail.com> wrote:

> There are only two ways I can think of to accomplish this and neither of
> them are dynamically setting the suggester field as is looks according to
> the Doc (which does sometimes have lacking info so I might be wrong) you
> cannot set something like *suggest.fl=combo_box_field* at query time. But
> maybe they can help you get started.
>
> 1. Multiple suggester request handlers for each option in combo box. This
> way you just change the request handler in the query you submit based on
> the context.
>
> 2. Use copy fields to put all possible suggestions into same field name, so
> no more dynamic field settings, with another field defining whatever the
> option would be for that document out of the combo box and use context
> filters which can be passed at query time to limit the suggestions to those
> filtered by whats in the combo box.
>
> https://cwiki.apache.org/confluence/display/solr/Suggester#Suggester-ContextFiltering
>
> Hope this helps a bit
>
> Nick
>
> On Wed, May 11, 2016 at 7:05 AM, Lasitha Wattaladeniya <wa...@gmail.com>
> wrote:
>
> > Hello devs,
> >
> > I'm trying to implement auto complete text suggestions using solr. I
> have a
> > text box and next to that there's a combo box. So the auto complete
> should
> > suggest based on the value selected in the combo box.
> >
> > Basically I should be able to change the suggest field based on the value
> > selected in the combo box. I was trying to solve this problem whole day
> but
> > not much luck. Can anybody tell me is there a way of doing this ?
> >
> > Regards,
> > Lasitha.
> >
> > Lasitha Wattaladeniya
> > Software Engineer
> >
> > Mobile : +6593896893
> > Blog : techreadme.blogspot.com
> >
>

Re: Dynamically change solr suggest field

Posted by Nick D <nd...@gmail.com>.
There are only two ways I can think of to accomplish this and neither of
them are dynamically setting the suggester field as is looks according to
the Doc (which does sometimes have lacking info so I might be wrong) you
cannot set something like *suggest.fl=combo_box_field* at query time. But
maybe they can help you get started.

1. Multiple suggester request handlers for each option in combo box. This
way you just change the request handler in the query you submit based on
the context.

2. Use copy fields to put all possible suggestions into same field name, so
no more dynamic field settings, with another field defining whatever the
option would be for that document out of the combo box and use context
filters which can be passed at query time to limit the suggestions to those
filtered by whats in the combo box.
https://cwiki.apache.org/confluence/display/solr/Suggester#Suggester-ContextFiltering

Hope this helps a bit

Nick

On Wed, May 11, 2016 at 7:05 AM, Lasitha Wattaladeniya <wa...@gmail.com>
wrote:

> Hello devs,
>
> I'm trying to implement auto complete text suggestions using solr. I have a
> text box and next to that there's a combo box. So the auto complete should
> suggest based on the value selected in the combo box.
>
> Basically I should be able to change the suggest field based on the value
> selected in the combo box. I was trying to solve this problem whole day but
> not much luck. Can anybody tell me is there a way of doing this ?
>
> Regards,
> Lasitha.
>
> Lasitha Wattaladeniya
> Software Engineer
>
> Mobile : +6593896893
> Blog : techreadme.blogspot.com
>