簡體   English   中英

Solr Delta導入查詢不起作用

[英]Solr Delta Import Query is not working

我正在嘗試將數據從Mongodb導入到Solr6.0。 完全導入正在正確執行,但增量導入無法正常工作。 當我執行增量導入時,我得到以下結果。

請求:0,已提取:0,已跳過:0,已處理:0

我的數據配置文件查詢如下

query=""

deltaQuery="db.getCollection('customer').find({'jDate':{$gt:'${dih.last_index_time}'}},{'_id' :1});"
deltaImportQuery="db.getCollection('customer').find({'_id':'${dataimporter.delta.id}'})"

整個data-config.xml

<?xml version="1.0"?>
<dataConfig>
<dataSource name="MyMongo" type="MongoDataSource" database="test_db" />
<document name="import">
 <!-- if query="" then it imports everything -->
     <entity  processor="MongoEntityProcessor"
             query=""
             deltaQuery="db.getCollection('customer').find({'jDate':{$gt: '${dih.last_index_time}'}},{'_id' :1});"
             deltaImportQuery="db.getCollection('customer').find({'_id':'${dataimporter.delta.id}'})"
             collection="customer"   
             datasource="MyMongo"
             transformer="MongoMapperTransformer" name="sample_entity">

               <!--  If mongoField name and the field declared in schema.xml are same than no need to declare below.
                     If not same than you have to refer the mongoField to field in schema.xml
                    ( Ex: mongoField="EmpNumber" to name="EmployeeNumber"). -->                                              

           <field column="_id"  name="id"/>  
           <field column="CustID" name="CustID" mongoField="CustID"/>       

           <field column="CustName" name="CustName" mongoField="CustName"/>       
            <field column="jDate" name="jDate" mongoField="jDate"/>
            <field column="dob" name="dob" mongoField="dob"/>          
       </entity>
 </document>
</dataConfig>

我嘗試使用硬編碼的值,但仍然無法像下面那樣工作

     query=""
     deltaQuery="db.getCollection('customer').find({'jDate':{$gt: new Date(1480581295000)}},{'_id' :1});"

deltaImportQuery="db.getCollection('customer').find({'_id':ObjectId('34234234dfsd34534524234ee')})"

然后我嘗試做以下事情,但仍然沒有成功

query=""
         deltaQuery="{'jDate':{$gt: new Date(1480581295000)}}"
        deltaImportQuery="{'_id':ObjectId(34234234dfsd34534524234ee)}"

任何人,請可以。

是否可以將{'_id':'$ {dataimporter.delta.id}'}替換為{'_id':'$ {dataimporter.delta。 _id }'}在deltaImportQuery中。

deltaImportQuery:(僅在增量導入中使用)。存在命名空間$ {dih.delta。 可以在此查詢中使用的列名 }。 例如:從tbl中選擇*,其中id = $ {dih.delta.id} Solr1.4

如上所述,我們只能在增量名稱空間中使用列名稱。

從有問題的mysql進行delta導入期間也遇到相同的問題Solr delta import查詢異常

參考:
https://wiki.apache.org/solr/DataImportHandler https://wiki.apache.org/solr/DataImportHandler#Configuration_in_data-config.xml

你能試一下嗎

deltaQuery as db.getCollection('customer').find({'jDate':{$gt:**ISODate(**'${dih.last_index_time}'**)**}},{'_id' :1});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM