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 Ali Nazemian <al...@gmail.com> on 2014/09/28 21:25:12 UTC

boosting words from specific list

Dear all,
Hi,
I was wondering how can I implement solr boosting words from specific list
of important words? I mean I want to have a list of important words and
tell solr to score documents based on the weighted sum of these words. For
example let word "school" has weight of 2 and word "president" has the
weight of 5. In this case a doc with 2 "school" words and 3 "president"
words will has the total score of 19! I want to sort documents based on
this score. How such procedure is possible in solr? Thank you very much.
Best regards.

-- 
A.Nazemian

Re: boosting words from specific list

Posted by Ahmet Arslan <io...@yahoo.com.INVALID>.
Hi Ali,

May be you can leverage  <filter class="solr.KeepWordFilterFactory" words="words.txt" ignoreCase="true"/>

Ahmet



On Sunday, September 28, 2014 10:25 PM, Ali Nazemian <al...@gmail.com> wrote:
Dear all,
Hi,
I was wondering how can I implement solr boosting words from specific list
of important words? I mean I want to have a list of important words and
tell solr to score documents based on the weighted sum of these words. For
example let word "school" has weight of 2 and word "president" has the
weight of 5. In this case a doc with 2 "school" words and 3 "president"
words will has the total score of 19! I want to sort documents based on
this score. How such procedure is possible in solr? Thank you very much.
Best regards.

-- 
A.Nazemian


Re: boosting words from specific list

Posted by Manuel Le Normand <ma...@gmail.com>.
I have not tried it but I would check the option of using the synonymFilter
to duplicate certain query words . Anothe opt - you can detect these word
at index time (eg. UpdateProcessor) to give these documents a document
boost in case it fits your logic. Or even make a copy field that contains a
whitelist words and query two fields each query - the original and the
copyField.
With debug query you'll be able to get the scores and adjust your boosts.
Small issue, many solutions. Look what works for you
Manuel

Re: boosting words from specific list

Posted by Ali Nazemian <al...@gmail.com>.
Dear Koji,
Also would you please tell me how can I access the term frequency for each
word? Should I do a word count on content or Is it possible to have access
to reverse index information to make the process more efficient? I dont
want to add too much time to the time of indexing documents.

On Tue, Sep 30, 2014 at 7:07 PM, Ali Nazemian <al...@gmail.com> wrote:

> Dear Koji,
> Hi,
> Thank you very much.
> Do you know any example code for UpdateRequestProcessor? Anything would be
> appreciated.
> Best regards.
>
> On Tue, Sep 30, 2014 at 3:41 AM, Koji Sekiguchi <ko...@r.email.ne.jp>
> wrote:
>
>> Hi Ali,
>>
>> I don't think Solr has such function OOTB. One way I can think of is that
>> you can implement UpdateRequestProcessor. In processAdd() method of
>> the UpdateRequestProcessor, as you can read field values, you can
>> calculate
>> the total score and copy the total score to a field e.g. total_score.
>> Then you can sort the query result on total_score field when you query.
>>
>> Koji
>> --
>> http://soleami.com/blog/comparing-document-classification-functions-of-
>> lucene-and-mahout.html
>>
>>
>> (2014/09/29 4:25), Ali Nazemian wrote:
>>
>>> Dear all,
>>> Hi,
>>> I was wondering how can I implement solr boosting words from specific
>>> list
>>> of important words? I mean I want to have a list of important words and
>>> tell solr to score documents based on the weighted sum of these words.
>>> For
>>> example let word "school" has weight of 2 and word "president" has the
>>> weight of 5. In this case a doc with 2 "school" words and 3 "president"
>>> words will has the total score of 19! I want to sort documents based on
>>> this score. How such procedure is possible in solr? Thank you very much.
>>> Best regards.
>>>
>>>
>>
>>
>>
>
>
> --
> A.Nazemian
>



-- 
A.Nazemian

Re: boosting words from specific list

Posted by Ali Nazemian <al...@gmail.com>.
Dear Koji,
Hi,
Thank you very much.
Do you know any example code for UpdateRequestProcessor? Anything would be
appreciated.
Best regards.

On Tue, Sep 30, 2014 at 3:41 AM, Koji Sekiguchi <ko...@r.email.ne.jp> wrote:

> Hi Ali,
>
> I don't think Solr has such function OOTB. One way I can think of is that
> you can implement UpdateRequestProcessor. In processAdd() method of
> the UpdateRequestProcessor, as you can read field values, you can calculate
> the total score and copy the total score to a field e.g. total_score.
> Then you can sort the query result on total_score field when you query.
>
> Koji
> --
> http://soleami.com/blog/comparing-document-classification-functions-of-
> lucene-and-mahout.html
>
>
> (2014/09/29 4:25), Ali Nazemian wrote:
>
>> Dear all,
>> Hi,
>> I was wondering how can I implement solr boosting words from specific list
>> of important words? I mean I want to have a list of important words and
>> tell solr to score documents based on the weighted sum of these words. For
>> example let word "school" has weight of 2 and word "president" has the
>> weight of 5. In this case a doc with 2 "school" words and 3 "president"
>> words will has the total score of 19! I want to sort documents based on
>> this score. How such procedure is possible in solr? Thank you very much.
>> Best regards.
>>
>>
>
>
>


-- 
A.Nazemian

Re: boosting words from specific list

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Hi Ali,

I don't think Solr has such function OOTB. One way I can think of is that
you can implement UpdateRequestProcessor. In processAdd() method of
the UpdateRequestProcessor, as you can read field values, you can calculate
the total score and copy the total score to a field e.g. total_score.
Then you can sort the query result on total_score field when you query.

Koji
-- 
http://soleami.com/blog/comparing-document-classification-functions-of-lucene-and-mahout.html

(2014/09/29 4:25), Ali Nazemian wrote:
> Dear all,
> Hi,
> I was wondering how can I implement solr boosting words from specific list
> of important words? I mean I want to have a list of important words and
> tell solr to score documents based on the weighted sum of these words. For
> example let word "school" has weight of 2 and word "president" has the
> weight of 5. In this case a doc with 2 "school" words and 3 "president"
> words will has the total score of 19! I want to sort documents based on
> this score. How such procedure is possible in solr? Thank you very much.
> Best regards.
>