DisMax search on field only if it exists otherwise fall-back to another
Hi list! The question was already asked by Neil Prosser sometime in 2015 but apparently never got a reply, so here's to better luck this time: At the moment I'm using a DisMax query which looks something like the following (massively cut-down): ?defType=dismax &q=some query &qf=field_one^0.5 field_two^1.0 I've got some localisation work coming up where I'd like to use the value of one, sparsely populated field if it exists, falling back to another if it doesn't (rather than duplicating some default value for all territories). Using the standard query parser I understand I can do the following to get this behaviour: ?q=if(exist(field_one),(field_one:some query),(field_three:some query)) However, I don't know how I would go about using DisMax for this type of fallback. Has anyone tried to do this sort of thing before? Is there a way to use functions within the qf parameter?
DisMax search on field only if it exists otherwise fall-back to another
Hopefully this question makes sense. At the moment I'm using a DisMax query which looks something like the following (massively cut-down): ?defType=dismax &q=some query &qf=field_one^0.5 field_two^1.0 I've got some localisation work coming up where I'd like to use the value of one, sparsely populated field if it exists, falling back to another if it doesn't (rather than duplicating some default value for all territories). Using the standard query parser I understand I can do the following to get this behaviour: ?q=if(exist(field_one),(field_one:some query),(field_three:some query)) However, I don't know how I would go about using DisMax for this type of fallback. Has anyone tried to do this sort of thing before? Is there a way to use functions within the qf parameter?
Re: DisMax search
Sorry my bad :(. Thanks for the help. It worked. I completely overlooked the defType. -- View this message in context: http://lucene.472066.n3.nabble.com/DisMax-search-tp3455671p3458454.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: DisMax search
> I am searching for 9065 , so its not > about case sensitivity. My search is > searching across all the field names and not limiting it to > one > field(specified in the qf param and using deftype dismax) By saying case sensitivity, Erik was referring def*T*ype parameter itself. (not the value of query) http://wiki.apache.org/solr/CommonQueryParameters#defType
Re: DisMax search
I am searching for 9065 , so its not about case sensitivity. My search is searching across all the field names and not limiting it to one field(specified in the qf param and using deftype dismax) -- View this message in context: http://lucene.472066.n3.nabble.com/DisMax-search-tp3455671p3456716.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: DisMax search
Maybe a case sensitive issue? defType it should be. Erik On Oct 26, 2011, at 16:03, jyn7 wrote: > Hi, > > I am using a dismax search and limiting the query parameters using qf: > /solrbgp/select/?facet=true&qf=memnum&q=%229065%22&deftype=dismax&start=0&rows=10 > > My understanding is SOLR should now search only the memnum field for an > exact match of "9065", since there is no data with memnum 9065 I should be > getting an empty result set, but instead the result that comes up has 9065 > in another indexed string field(email) and not the memnum field. > > > How do I limit the search to one single field? > > Thanks. > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/DisMax-search-tp3455671p3455671.html > Sent from the Solr - User mailing list archive at Nabble.com.
Re: perfect match in dismax search
Good work. It's a great idea 2011/3/3 Jan Høydahl > Hi, > > I'm working on a Filter which enables boundary match using syntax > title:"^hello I love you$" > which will make sure that the match is exact. See SOLR-1980 (no working > patch yet) > > -- > Jan Høydahl, search solution architect > Cominvent AS - www.cominvent.com > > On 3. mars 2011, at 11.07, Markus Jelsma wrote: > > > Use either the string fieldType or a field with very little analysis > > (KeywordTokenizer + LowercaseFilter). > > > >> How to obtain perfect match with dismax query?? > >> > >> es: > >> > >> i want to search "hello i love you" with deftype=dismax in the title > field > >> and i want to obtain results which title is exactly "hello i love you" > with > >> all this terms > >> in this order. > >> > >> Not less words or other. > >> how is it possilbe?? > >> > >> i tryed with +(hello i love you) but if i have a title which is "hello i > >> love you mum" it matches and i don't want! > >> > >> Thanx > > -- Gastone Penzo Webster Srl www.webster.it www.libreriauniversitaria.it
Re: perfect match in dismax search
Hi, I'm working on a Filter which enables boundary match using syntax title:"^hello I love you$" which will make sure that the match is exact. See SOLR-1980 (no working patch yet) -- Jan Høydahl, search solution architect Cominvent AS - www.cominvent.com On 3. mars 2011, at 11.07, Markus Jelsma wrote: > Use either the string fieldType or a field with very little analysis > (KeywordTokenizer + LowercaseFilter). > >> How to obtain perfect match with dismax query?? >> >> es: >> >> i want to search "hello i love you" with deftype=dismax in the title field >> and i want to obtain results which title is exactly "hello i love you" with >> all this terms >> in this order. >> >> Not less words or other. >> how is it possilbe?? >> >> i tryed with +(hello i love you) but if i have a title which is "hello i >> love you mum" it matches and i don't want! >> >> Thanx
Re: perfect match in dismax search
Use either the string fieldType or a field with very little analysis (KeywordTokenizer + LowercaseFilter). > How to obtain perfect match with dismax query?? > > es: > > i want to search "hello i love you" with deftype=dismax in the title field > and i want to obtain results which title is exactly "hello i love you" with > all this terms > in this order. > > Not less words or other. > how is it possilbe?? > > i tryed with +(hello i love you) but if i have a title which is "hello i > love you mum" it matches and i don't want! > > Thanx
perfect match in dismax search
How to obtain perfect match with dismax query?? es: i want to search "hello i love you" with deftype=dismax in the title field and i want to obtain results which title is exactly "hello i love you" with all this terms in this order. Not less words or other. how is it possilbe?? i tryed with +(hello i love you) but if i have a title which is "hello i love you mum" it matches and i don't want! Thanx -- Gastone Penzo Webster Srl www.webster.it www.libreriauniversitaria.it