Well, you have to _do_ something with the field. And you don't
particularly want to do document boosting at index time in the first
place as this has been removed recently IIRC. Note this is different
than just putting a _value_ in some field you _use_ for boosting......

Anyway, you state:
"I would like to have documents with boost value 30 to be shown above
the documents with value 10 or 20"

If it's acceptable that all docs with a value of 30 appear before all
docs with a value of 20 which appear before all docs with a value of
10, then this is just a simple sort

sort=boost desc,score desc

If you want to do something fancier, see Function Queries in the ref
guide. Or use edismax query parsing and add a boost query

Best,
Erick



On Fri, Aug 11, 2017 at 10:19 AM, Abhijit Pawar
<abhijit.ibizs...@gmail.com> wrote:
> Hi,
>
> I am working on a scenario trying to boost certain documents while indexing
> over other documents.
>
> I am using  a DataImportHandler to import JSON documents from a MongoDB
> datasource.
>
> Here's my data-source-config file :
>
> <dataConfig>
> <dataSource name="mongod" type="JdbcDataSource"
> driver="com.mongodb.jdbc.MongoDriver" url="mongodb://<<HOST>>:27017/CORE"/>
>  <script><![CDATA[
>     function BoostDoc(row) {
>        if(row.get('boost') == '10') {
>           row.put('$docBoost', 10);
>        }
> if(row.get('boost') == '20') {
>           row.put('$docBoost', 20);
>        }
>    if(row.get('boost') == '30') {
>           row.put('$docBoost', 30);
>        }
>        return row;
>     }
>   ]]></script>
> <document name="products">
> <entity name="products"
> dataSource="mongod"
> transformer="ProdsCatsFieldTransformer,script:BoostDoc,TemplateTransformer"
> onError="continue"
> pk="uuid"
> query="SELECT  idStr,orgidStr,name,boost,code,description....
>         FROM products"
> deltaImportQuery="SELECT idStr,orgidStr,name,boost,code,description....
>         FROM products"...
> deltaQuery="SELECT idStr FROM products WHERE orgidStr ....
>
>>
> <field column="idStr" name="prod_idStr"/>
> <field column="uuid" name="uuid" template="prod-${products.idStr}"/>
> <field column="orgidStr" name="prod_org"/>
> <field column="name" name="prod_name"/>
> <field column="boost" name="prod_boost"/>
>
> I have added omiNorms to unique identifier  - uuid.
>
>
> With this configuration I am unable to see any change in the results
> returned while search.Basically I would like to have documents with boost
> value 30 to be shown above the documents with value 10 or 20.
>
> Is there change I need to make in order to apply boost values using
> $docBoost with ScriptTransformer ?
>
> Also any other alternative approach that I may use for achieving the
> boosted documents to show up in the results list.
>
>
>
> Regards,
>
> Abhijit

Reply via email to