Does Solr data import handler support custom variables?

被刻印的时光 ゝ 提交于 2019-12-22 17:41:03

问题


I currently have an issue with my data import handler where ${dataimporter.last_index_time} is not granular enough to capture two events that happen within a second of each other, leading to issues where a record is skipped over in my database.

I am thinking to replace last_index_time with a simple atomically incrementing value as opposed to a datetime, but in order to do that I need to be able to set and read custom variables through solr that can be referenced in my data-config.xml file.

Alternatively, if I could find some way to set dataimporter.last_index_time, that would work just as well as I could ensure that the last_index_time is less than the newly-committed rows (and more importantly, that it is set from the same clock).

Does Solr support this?


回答1:


Short answer: Yes it does

Long answer:

At work I'm passing parameters in request (DataImportHandler: Accessing request parameters) with default values set in handler (solrconfig.xml)

To sum up:

You can do use something like that in data-config.xml

${dataimporter.request.your_variable}

With request:

/dataimport&command=delta-import&clean=false&commit=true&your_variable=123


来源:https://stackoverflow.com/questions/17240826/does-solr-data-import-handler-support-custom-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!