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 Jon Drukman <jd...@gmail.com> on 2010/02/05 20:17:13 UTC
Boost documents based on a constant value in a field
I have a very simple schema: two integers and two text fields.
<fields>
<field name="answer_id" type="integer" indexed="true" stored="true"
required="true" />
<field name="question" type="text" indexed="true" stored="true"/>
<field name="question_source" type="integer" indexed="true"
stored="true"/>
<field name="answer" type="text" indexed="true" stored="false"/>
</fields>
I want to do full text searching on the text fields as normal. However,
I want to boost all documents where question_source == 3 to the top.
How do I do that?
So the results should be:
All documents where question_source == 3 first, sorted by relevance in
the text fields.
All other documents sorted by text field relevance.
How do I achieve this?
-jsd-
Re: Boost documents based on a constant value in a field
Posted by Wangsheng Mei <ha...@gmail.com>.
you would use bq parameter to boost question_source==3 documents first.
similar to:
http://solr/select?q=your_query&qt=dismax&bq=question_source:3^1000
2010/2/6 Jon Drukman <jd...@gmail.com>
> I have a very simple schema: two integers and two text fields.
>
> <fields>
> <field name="answer_id" type="integer" indexed="true" stored="true"
> required="true" />
> <field name="question" type="text" indexed="true" stored="true"/>
> <field name="question_source" type="integer" indexed="true"
> stored="true"/>
> <field name="answer" type="text" indexed="true" stored="false"/>
> </fields>
>
> I want to do full text searching on the text fields as normal. However, I
> want to boost all documents where question_source == 3 to the top. How do I
> do that?
>
> So the results should be:
>
> All documents where question_source == 3 first, sorted by relevance in the
> text fields.
>
> All other documents sorted by text field relevance.
>
> How do I achieve this?
>
> -jsd-
>
>
--
梅旺生