lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abhijit Pawar <abhijit.ibizs...@gmail.com>
Subject How to boost entire json document on top of results
Date Fri, 11 Aug 2017 17:19:20 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message