Re: Dereferencing boost values?
: For numeric operands, is the dismax boost operator ^ just a pow()? If so, my : problem is solved by doing that: : pow(product(a,$a1),$fa) pow(sum(b,$b1,$b2),$fb) : pow(c,$fc) : Is a^b equiv to pow(a,b)? not exactly ... the "bf" syntax is really, really, really old ... it was a really early attempt at making it easy to say "i want to create a query that wraps a function" before the days of the QParser framework and being able to pick parsers via localparams. when you see a "^" in a bf param that is saying "take everything to the left of this and make it a function, wrap it in a query, and then use the number to the right of this as the value for the setBoost(float) on that Query" Historically, the only reason you even *needed* the "^" syntax in the bf, was to set a nice big "boost" value on those FunctionQuery objects, so that the (absolute) values returned by those functions could have a meaningful effect when *added* to the scores of the main query. because like i mentioned -- "bf" only gives you add additive boost. i don't recommend anyone use it for anything these days -- switching to the "boost" param of the edismax parser, or wrapping your entire query in the "boost" QParser is almost always better -- you just have to experiment and figure out a good function to use and good constantsto use when you make the transition -- otherwise you might find your existing bf functions are either over or under powered. if you really want to keep using the additive boosts of the 'bf' field and paramaterize the current "^boost" values you are using, the closest corelary using the function syntax would be the prod() (ie: 'product') function... bf = prod(a,$a1,$fa) prod(sum(b,$b1,$b2),$fb) ... : On 7/14/2015 2:31 PM, Chris Hostetter wrote: : > To clarify the difference: : > : > - "bf" is a special param of the dismax parser, which does an *additive* : > boost function - that function can be something as simple as a numeric : > field : > : > - alternatively, you can use the "boost" parser in your main query string, : > to wrap any parser (dismax, edismax, standard, whatever) in a : > *multiplicitive* boost, where the boost function can be anything : > : > - multiplicitve boosts are almost always what people really want, additive : > boosts are a lot less useful. : > : > - when specifying any function, you can use variable derefrencing for any : > function params. : > : > So in the example Upayavira gave, you can use any arbitrary query param to : > specify the function to use as a multiplicitive boost arround an arbitrary : > query -- which could still use dismax if you want (just specify the : > neccessary parser "type" as a localparam on the inner query, or use a : > defType localparam on the original boost query). Or you could explicitly : > specify a function that incorporates a field value with some other : > dynamic params, and use that entire function as your multiplicitive boost. : > : > a more elaborate example using the "bin/solr -e techproducts" data... : > : > http://localhost:8983/solr/techproducts/query?debug=query&q={!boost%20b=$boost_func%20defType=dismax%20v=$qq}&qf=name+title&qq=apple%20ipod&boost_func=pow%28$boost_field,$boost_factor%29&boost_field=price&boost_factor=2 : > : > "params":{ : >"qq":"apple ipod", : >"q":"{!boost b=$boost_func defType=dismax v=$qq}", : >"debug":"query", : >"qf":"name title", : >"boost_func":"pow($boost_field,$boost_factor)", : >"boost_factor":"2", : >"boost_field":"price"}}, : > : > : > : > : > : > : > : > : Date: Tue, 14 Jul 2015 21:58:36 +0100 : > : From: Upayavira : > : Reply-To: solr-user@lucene.apache.org : > : To: solr-user@lucene.apache.org : > : Subject: Re: Dereferencing boost values? : > : : > : You could do : > : : > : q={!boost b=$b v=$qq} : > : qq=your query : > : b=YOUR-FACTOR : > : : > : If what you want is to provide a value outside. : > : : > : Also, with later Solrs, you can use ${whatever} syntax in your main : > : query, which might work for you too. : > : : > : Upayavira : > : : > : On Tue, Jul 14, 2015, at 09:28 PM, Olivier Lebra wrote: : > : > Is there a way to do something like this: " bf=myfield^$myfactor " ? : > : > (Doesn't work, the boost value has to be a direct number) : > : > : > : > Thanks, : > : > Olivier : > : : > : > -Hoss : > http://www.lucidworks.com/ : : -Hoss http://www.lucidworks.com/
Re: Dereferencing boost values?
Thanks guys... I'm using edismax, and I have a long bf field, that I want in a solr's requesthandler config as default, but customizable via query string, something like that: product(a,$a)^$fa sum(b,$b1,$b2)^$fb c^$fc ... where the caller would pass $a, $fa, $b1, $b2, $fb, $fc (and a, b, c are numeric fields) So my problem is with $fa, $fb, and $fc. Solr doesn't take that syntax. For numeric operands, is the dismax boost operator ^ just a pow()? If so, my problem is solved by doing that: pow(product(a,$a1),$fa) pow(sum(b,$b1,$b2),$fb) pow(c,$fc) Is a^b equiv to pow(a,b)? Thanks, Olivier On 7/14/2015 2:31 PM, Chris Hostetter wrote: To clarify the difference: - "bf" is a special param of the dismax parser, which does an *additive* boost function - that function can be something as simple as a numeric field - alternatively, you can use the "boost" parser in your main query string, to wrap any parser (dismax, edismax, standard, whatever) in a *multiplicitive* boost, where the boost function can be anything - multiplicitve boosts are almost always what people really want, additive boosts are a lot less useful. - when specifying any function, you can use variable derefrencing for any function params. So in the example Upayavira gave, you can use any arbitrary query param to specify the function to use as a multiplicitive boost arround an arbitrary query -- which could still use dismax if you want (just specify the neccessary parser "type" as a localparam on the inner query, or use a defType localparam on the original boost query). Or you could explicitly specify a function that incorporates a field value with some other dynamic params, and use that entire function as your multiplicitive boost. a more elaborate example using the "bin/solr -e techproducts" data... http://localhost:8983/solr/techproducts/query?debug=query&q={!boost%20b=$boost_func%20defType=dismax%20v=$qq}&qf=name+title&qq=apple%20ipod&boost_func=pow%28$boost_field,$boost_factor%29&boost_field=price&boost_factor=2 "params":{ "qq":"apple ipod", "q":"{!boost b=$boost_func defType=dismax v=$qq}", "debug":"query", "qf":"name title", "boost_func":"pow($boost_field,$boost_factor)", "boost_factor":"2", "boost_field":"price"}}, : Date: Tue, 14 Jul 2015 21:58:36 +0100 : From: Upayavira : Reply-To: solr-user@lucene.apache.org : To: solr-user@lucene.apache.org : Subject: Re: Dereferencing boost values? : : You could do : : q={!boost b=$b v=$qq} : qq=your query : b=YOUR-FACTOR : : If what you want is to provide a value outside. : : Also, with later Solrs, you can use ${whatever} syntax in your main : query, which might work for you too. : : Upayavira : : On Tue, Jul 14, 2015, at 09:28 PM, Olivier Lebra wrote: : > Is there a way to do something like this: " bf=myfield^$myfactor " ? : > (Doesn't work, the boost value has to be a direct number) : > : > Thanks, : > Olivier : -Hoss http://www.lucidworks.com/
Re: Dereferencing boost values?
To clarify the difference: - "bf" is a special param of the dismax parser, which does an *additive* boost function - that function can be something as simple as a numeric field - alternatively, you can use the "boost" parser in your main query string, to wrap any parser (dismax, edismax, standard, whatever) in a *multiplicitive* boost, where the boost function can be anything - multiplicitve boosts are almost always what people really want, additive boosts are a lot less useful. - when specifying any function, you can use variable derefrencing for any function params. So in the example Upayavira gave, you can use any arbitrary query param to specify the function to use as a multiplicitive boost arround an arbitrary query -- which could still use dismax if you want (just specify the neccessary parser "type" as a localparam on the inner query, or use a defType localparam on the original boost query). Or you could explicitly specify a function that incorporates a field value with some other dynamic params, and use that entire function as your multiplicitive boost. a more elaborate example using the "bin/solr -e techproducts" data... http://localhost:8983/solr/techproducts/query?debug=query&q={!boost%20b=$boost_func%20defType=dismax%20v=$qq}&qf=name+title&qq=apple%20ipod&boost_func=pow%28$boost_field,$boost_factor%29&boost_field=price&boost_factor=2 "params":{ "qq":"apple ipod", "q":"{!boost b=$boost_func defType=dismax v=$qq}", "debug":"query", "qf":"name title", "boost_func":"pow($boost_field,$boost_factor)", "boost_factor":"2", "boost_field":"price"}}, : Date: Tue, 14 Jul 2015 21:58:36 +0100 : From: Upayavira : Reply-To: solr-user@lucene.apache.org : To: solr-user@lucene.apache.org : Subject: Re: Dereferencing boost values? : : You could do : : q={!boost b=$b v=$qq} : qq=your query : b=YOUR-FACTOR : : If what you want is to provide a value outside. : : Also, with later Solrs, you can use ${whatever} syntax in your main : query, which might work for you too. : : Upayavira : : On Tue, Jul 14, 2015, at 09:28 PM, Olivier Lebra wrote: : > Is there a way to do something like this: " bf=myfield^$myfactor " ? : > (Doesn't work, the boost value has to be a direct number) : > : > Thanks, : > Olivier : -Hoss http://www.lucidworks.com/
Re: Dereferencing boost values?
You could do q={!boost b=$b v=$qq} qq=your query b=YOUR-FACTOR If what you want is to provide a value outside. Also, with later Solrs, you can use ${whatever} syntax in your main query, which might work for you too. Upayavira On Tue, Jul 14, 2015, at 09:28 PM, Olivier Lebra wrote: > Is there a way to do something like this: " bf=myfield^$myfactor " ? > (Doesn't work, the boost value has to be a direct number) > > Thanks, > Olivier
Dereferencing boost values?
Is there a way to do something like this: " bf=myfield^$myfactor " ? (Doesn't work, the boost value has to be a direct number) Thanks, Olivier