Yes just add if statement based on a field type and do a row.put() only if
that other value is a certain value.



On 3/9/11 1:39 PM, "Brian Lamb" <brian.l...@journalexperts.com> wrote:

>That makes sense. As a follow up, is there a way to only conditionally use
>the boost score? For example, in some cases I want to use the boost score
>and in other cases I want all documents to be treated equally.
>
>On Wed, Mar 9, 2011 at 2:42 PM, Jayendra Patil
><jayendra.patil....@gmail.com
>> wrote:
>
>> you can use the ScriptTransformer to perform the boost calcualtion and
>> addition.
>> http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer
>>
>> <dataConfig>
>>        <script><![CDATA[
>>                function f1(row)  {
>>                    // Add boost
>>                    row.put('$docBoost',1.5);
>>                    return row;
>>                }
>>        ]]></script>
>>        <document>
>>                <entity name="e" pk="id" transformer="script:f1"
>> query="select * from X">
>>                ....
>>                </entity>
>>        </document>
>> </dataConfig>
>>
>> Regards,
>> Jayendra
>>
>>
>> On Wed, Mar 9, 2011 at 2:01 PM, Brian Lamb
>> <brian.l...@journalexperts.com> wrote:
>> > Anyone have any clue on this on?
>> >
>> > On Tue, Mar 8, 2011 at 2:11 PM, Brian Lamb <
>> brian.l...@journalexperts.com>wrote:
>> >
>> >> Hi all,
>> >>
>> >> I am using dataimport to create my index and I want to use docBoost
>>to
>> >> assign some higher weights to certain docs. I understand the concept
>> behind
>> >> docBoost but I haven't been able to find an example anywhere that
>>shows
>> how
>> >> to implement it. Assuming the following config file:
>> >>
>> >> <document>
>> >>    <entity name="animal"
>> >>               dataSource="animals"
>> >>               pk="id"
>> >>               query="SELECT * FROM animals">
>> >>     <field column="id" name="id" />
>> >>     <field column="genus" name="genus" />
>> >>     <field column="species" name="species" />
>> >>     <entity name="boosters"
>> >>                dataSource="boosts"
>> >>                query="SELECT boost_score FROM boosts WHERE animal_id
>>=
>> ${
>> >> animal.id}">
>> >>       <field column="boost_score" name="boost_score />
>> >>     </entity>
>> >>   </entity>
>> >> </document>
>> >>
>> >> How do I add in a docBoost score? The boost score is currently in a
>> >> separate table as shown above.
>> >>
>> >
>>


Reply via email to