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 bbarani <bb...@gmail.com> on 2012/11/30 18:16:47 UTC

Best way to increase boost to results that 'starts with' search keyword

Hi,

I need to boost the document containing the search keyword in the first
position of the indexed data, ex:

If I have 3 data indexed as below,

Account number
Data account and account number
Information number account data account
Account indicator

when users searches for keyword account, I want solr to first bring in the
documents that starts with the search keyword followed by other documents.

so the result should be

Account Number
Account indicator
Data account and account number
Information number account data account

Is it possible to do this?

Thanks,
BB



--
View this message in context: http://lucene.472066.n3.nabble.com/Best-way-to-increase-boost-to-results-that-starts-with-search-keyword-tp4023502.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Best way to increase boost to results that 'starts with' search keyword

Posted by Markus Jelsma <ma...@openindex.io>.
This issue adds the SpanFirstQuery to edismax.
https://issues.apache.org/jira/browse/SOLR-3925

It unfortuntately cannot produce progressively higher boosts if the term is closer to the beginning.

 
 
-----Original message-----
> From:Jack Krupansky <ja...@basetechnology.com>
> Sent: Fri 30-Nov-2012 18:54
> To: solr-user@lucene.apache.org
> Subject: Re: Best way to increase boost to results that 'starts with' search keyword
> 
> Two choices:
> 
> 1. You need the Lucene SpanFirstQuery, but the normal Solr query parsers 
> don't support it, so you need to roll your own.
> 2. Do a custom update processor that at index time inserts a special start 
> marker like "aaafirstaaa" at the beginning of each field that needs this 
> feature. Then, you can query for "aaafirstaaa accounting" to find documents 
> wih accounting as the first term.
> 
> If you are ambitious, you could modify/extend the Solr query parser (or 
> edismax) to add a custom boost that uses SpanFirstQuery and each term or 
> phrase. Call it "boostInitial" or something like that.
> 
> The latter would be a great feature request for Solr. (And a nice start for 
> an enterprising developer seeking to progress along on the path to becoming 
> a committer!)
> 
> -- Jack Krupansky
> 
> -----Original Message----- 
> From: bbarani
> Sent: Friday, November 30, 2012 12:16 PM
> To: solr-user@lucene.apache.org
> Subject: Best way to increase boost to results that 'starts with' search 
> keyword
> 
> Hi,
> 
> I need to boost the document containing the search keyword in the first
> position of the indexed data, ex:
> 
> If I have 3 data indexed as below,
> 
> Account number
> Data account and account number
> Information number account data account
> Account indicator
> 
> when users searches for keyword account, I want solr to first bring in the
> documents that starts with the search keyword followed by other documents.
> 
> so the result should be
> 
> Account Number
> Account indicator
> Data account and account number
> Information number account data account
> 
> Is it possible to do this?
> 
> Thanks,
> BB
> 
> 
> 
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/Best-way-to-increase-boost-to-results-that-starts-with-search-keyword-tp4023502.html
> Sent from the Solr - User mailing list archive at Nabble.com. 
> 
> 

Re: Best way to increase boost to results that 'starts with' search keyword

Posted by Jack Krupansky <ja...@basetechnology.com>.
Two choices:

1. You need the Lucene SpanFirstQuery, but the normal Solr query parsers 
don't support it, so you need to roll your own.
2. Do a custom update processor that at index time inserts a special start 
marker like "aaafirstaaa" at the beginning of each field that needs this 
feature. Then, you can query for "aaafirstaaa accounting" to find documents 
wih accounting as the first term.

If you are ambitious, you could modify/extend the Solr query parser (or 
edismax) to add a custom boost that uses SpanFirstQuery and each term or 
phrase. Call it "boostInitial" or something like that.

The latter would be a great feature request for Solr. (And a nice start for 
an enterprising developer seeking to progress along on the path to becoming 
a committer!)

-- Jack Krupansky

-----Original Message----- 
From: bbarani
Sent: Friday, November 30, 2012 12:16 PM
To: solr-user@lucene.apache.org
Subject: Best way to increase boost to results that 'starts with' search 
keyword

Hi,

I need to boost the document containing the search keyword in the first
position of the indexed data, ex:

If I have 3 data indexed as below,

Account number
Data account and account number
Information number account data account
Account indicator

when users searches for keyword account, I want solr to first bring in the
documents that starts with the search keyword followed by other documents.

so the result should be

Account Number
Account indicator
Data account and account number
Information number account data account

Is it possible to do this?

Thanks,
BB



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Best-way-to-increase-boost-to-results-that-starts-with-search-keyword-tp4023502.html
Sent from the Solr - User mailing list archive at Nabble.com.