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 Dmitriy Shvadskiy <ds...@gmail.com> on 2011/05/18 00:45:15 UTC

Boosting non synonyms result

Hello,
Is there a way to boost the result that is an exact match as oppose to
synonym match when using query time synonyms?
Given the query John Smith and synonyms
Jonathan,Jonathan,John,Jon,Nat,Nathan

I'd like result containing John Smith to be ranked higher then Jonathan
Smith.
My thinking was to do it by defining 2 fields: 1 with query time synonyms
and 1 without and sort by a function query of a non-synonym field. Is it
even possible? I can't quite figure out the syntax for this.
I'm using Solr 3.1.

Thanks,
Dmitriy

Re: Boosting non synonyms result

Posted by Markus Jelsma <ma...@openindex.io>.
The only method i can think of is, as you mention, define a second field 
containing the exact match without synonym expansion.

In that case you can just put a larger boost value for matches on that field to 
rank it higher. Just sort score desc and check debugQuery output before and 
after.

> Hello,
> Is there a way to boost the result that is an exact match as oppose to
> synonym match when using query time synonyms?
> Given the query John Smith and synonyms
> Jonathan,Jonathan,John,Jon,Nat,Nathan
> 
> I'd like result containing John Smith to be ranked higher then Jonathan
> Smith.
> My thinking was to do it by defining 2 fields: 1 with query time synonyms
> and 1 without and sort by a function query of a non-synonym field. Is it
> even possible? I can't quite figure out the syntax for this.
> I'm using Solr 3.1.
> 
> Thanks,
> Dmitriy

Re: Boosting non synonyms result

Posted by Paul Libbrecht <pa...@hoplahup.net>.
I do it the same but do not use the Dismax query which is a lot too unflexible.

In CurrikiSolr, I have my own QueryComponent which does all sorts of query expansion:
- it expands a simple term query to a query for the text in the stemmed variant and in the unstemmed variant with more boost
- it pre-parses to make sure that phrase-queries remain phrase queries and thus become unstemmed queries
- it converts prefix queries to queries in the unstemmed field only
- it uses parameters (used in the "advanced search") to add queries (e.g. only resources with that topic)
- it applies some rights protections
- it would be the place to expand along the multiple languages if indexing each language in a separate field as I would do it
- it applies some application specific "quality boosting" (higher-ranked resources go higher)

I find that such a component is kind of best practice because it makes a server that can apply business logic (independently of hackers in the client), and gives me java to perform deep query processing instead of javascript for fragile string processing.
I guess I could find a way to extend intelligently, but I have not found it.

paul


Le 18 mai 2011 à 00:52, Jonathan Rochkind a écrit :

> I do it with two fields exactly how you say, but then use dismax to boost the non-synonom-ed field higher than the synonym-ed field.  That is a lot easier than trying to use a function query, which I'm not sure how to do either.
> 
> On 5/17/2011 6:45 PM, Dmitriy Shvadskiy wrote:
>> Hello,
>> Is there a way to boost the result that is an exact match as oppose to
>> synonym match when using query time synonyms?
>> Given the query John Smith and synonyms
>> Jonathan,Jonathan,John,Jon,Nat,Nathan
>> 
>> I'd like result containing John Smith to be ranked higher then Jonathan
>> Smith.
>> My thinking was to do it by defining 2 fields: 1 with query time synonyms
>> and 1 without and sort by a function query of a non-synonym field. Is it
>> even possible? I can't quite figure out the syntax for this.
>> I'm using Solr 3.1.
>> 
>> Thanks,
>> Dmitriy
>> 


Re: Boosting non synonyms result

Posted by Jonathan Rochkind <ro...@jhu.edu>.
I do it with two fields exactly how you say, but then use dismax to 
boost the non-synonom-ed field higher than the synonym-ed field.  That 
is a lot easier than trying to use a function query, which I'm not sure 
how to do either.

On 5/17/2011 6:45 PM, Dmitriy Shvadskiy wrote:
> Hello,
> Is there a way to boost the result that is an exact match as oppose to
> synonym match when using query time synonyms?
> Given the query John Smith and synonyms
> Jonathan,Jonathan,John,Jon,Nat,Nathan
>
> I'd like result containing John Smith to be ranked higher then Jonathan
> Smith.
> My thinking was to do it by defining 2 fields: 1 with query time synonyms
> and 1 without and sort by a function query of a non-synonym field. Is it
> even possible? I can't quite figure out the syntax for this.
> I'm using Solr 3.1.
>
> Thanks,
> Dmitriy
>