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 Brian Gerby <br...@hotmail.com> on 2011/10/08 03:26:40 UTC

Max Field Scoring?

Hi all - 
I am trying to figure out if a particular use case is possible with solr. Let's say we are using solr to store a group of people and the universities they attended. We have four fields - NAME, PHD to house the name of the university they received a phd degree from, MASTERS to house the name of the university they received a masters from and BACHELORS to house the university the received a bachelors from. We also want to give a really big boost to matches for the PHD field (100), a big boost for matches to the MASTERS field (50) and a small boost to matches for the BACHELORS field (10). If someone attended the same university for all three degrees, we only want to use the score for the highest boost, the PHD field. The desired net result would be a search for 'Stanford' would boost documents the same for someone that received a PHD from Stanford as someone that received a PHD, a MASTERS and a BACHELORS from Stanford. We don't want the boosted score of all three fields to be used so simply adding all the boosted fields won't work. Is this possible and if so, what's the best way? A boost function using subqueries?
Many thanks in advance, 

Brian
 		 	   		  

Re: Max Field Scoring?

Posted by Ahmet Arslan <io...@yahoo.com>.
> Thanks Ahmet. Do you know of a way to
> set a tie on only a set of fields, so in this case on PHD,
> MASTERS and BACHELORS, but not on name? The end result being
> s student named Stanford who went to Stanford for a PHD
> would get a higher score than someone named Joe with the
> same degree with a query for 'stanford'. My use case will
> have a few of these groupings. I'd like to use the tie for
> the groups, not all fields. 

Not sure about the exact syntax but I think you can do it with _query_ hook.

&q=_query_:"{!dismax qf='PHD^100 MASTERS^50 BACHELORS^10' tie='0'}standford" AND _query_:"{!dismax qf='NAME SURNAME' tie='0.1'}standford"

http://wiki.apache.org/solr/LocalParams
http://www.lucidimagination.com/blog/2009/03/31/nested-queries-in-solr/

Re: Max Field Scoring?

Posted by Brian Gerby <br...@hotmail.com>.
Thanks Ahmet. Do you know of a way to set a tie on only a set of fields, so in this case on PHD, MASTERS and BACHELORS, but not on name? The end result being s student named Stanford who went to Stanford for a PHD would get a higher score than someone named Joe with the same degree with a query for 'stanford'. My use case will have a few of these groupings. I'd like to use the tie for the groups, not all fields. 

On Oct 8, 2011, at 2:12 AM, Ahmet Arslan <io...@yahoo.com> wrote:

>> &defType=dismax&qf=NAME PHD MASTERS
>> BACHELORS&tie=0.0&q=Stanford
> 
> I forgot to add boost values
> 
> &defType=dismax&qf=NAME PHD^100 MASTERS^50 BACHELORS^10&tie=0.0&q=Stanford
> 

Re: Max Field Scoring?

Posted by Ahmet Arslan <io...@yahoo.com>.
> &defType=dismax&qf=NAME PHD MASTERS
> BACHELORS&tie=0.0&q=Stanford

I forgot to add boost values

&defType=dismax&qf=NAME PHD^100 MASTERS^50 BACHELORS^10&tie=0.0&q=Stanford

Re: Max Field Scoring?

Posted by Ahmet Arslan <io...@yahoo.com>.
> I am trying to figure out if a particular use case is
> possible with solr. Let's say we are using solr to store a
> group of people and the universities they attended. We have
> four fields - NAME, PHD to house the name of the university
> they received a phd degree from, MASTERS to house the name
> of the university they received a masters from and BACHELORS
> to house the university the received a bachelors from. We
> also want to give a really big boost to matches for the PHD
> field (100), a big boost for matches to the MASTERS field
> (50) and a small boost to matches for the BACHELORS field
> (10). If someone attended the same university for all three
> degrees, we only want to use the score for the highest
> boost, the PHD field. The desired net result would be a
> search for 'Stanford' would boost documents the same for
> someone that received a PHD from Stanford as someone that
> received a PHD, a MASTERS and a BACHELORS from Stanford. We
> don't want the boosted score of all three fields to be used
> so simply adding all the boosted fields won't work. Is this
> possible and if so, what's the best way? A boost function
> using subqueries?

Closest thing would be using dismax query parser with tie=0 value which makes the query pure "disjunction max query".

&defType=dismax&qf=NAME PHD MASTERS BACHELORS&tie=0.0&q=Stanford

http://wiki.apache.org/solr/DisMaxQParserPlugin#tie_.28Tie_breaker.29