lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Queries with conditional field inclusions?
Date Fri, 25 Oct 2013 19:47:14 GMT

: Search Department Name + Last Name every time
: include First Name if user type in (faculty, staff) or if another token
: matched last name.

I haven't tested this, but i think conceptually what you want is...

qq=richard frovarp
q={!maxscore v=$maxof}
maxof=({!dismax qf='lastname deptname' mm='100%' v=$qq}
       ( +{!dismax qf='lastname firstname deptname' mm='100%' v=$qq}
         +( type:(faculty staff)
            {!dismax qf=lastname mm='1' v=$qq}

You want to execute a query using the users input (qq) twice:
 * once against just the lsatnmae & department
 * once against first, last, and department name
   - but for this query, it's also mandatory that either:
     * type is faculty or staff
     * at least one clause of the users input matches on lastname
...and then you just want the highest scoring of those two verisons of the 

You might need to play with the qf boosts in both cases ... but i *think* 
that should get you where you want to be.


View raw message