0
我使用Apache Solr實現-6.0.0Solr的獲得最後索引時間編程
我有一個集合:我的搜索
每當我運行一個增量導入,在dataimport的last_index_time .properties文件正在更新。
有沒有辦法使用api調用獲取此值?如果是,那麼如何使用solrj庫讀取該值?
使用下面的API我能夠讀取該文件的內容:
http://localhost:8983/solr/my-search/admin/file?wt=json&file=dataimport.properties
樣的反應看起來:
#Thu Mar 23 10:00:01 UTC 2017
name.last_index_time=2017-03-23 10\:00\:01
last_index_time=2017-03-23 10\:00\:01
使用solrj java庫,我我在做以下事情:
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("qt", "/admin/file");
params.set("file", "dataimport.properties");
params.set("contentType", "text/plain;charset=utf-8");
try
{
return this.solr.query(collectionName, params);
}
catch (Exception e)
{
logger.info("Exception msg: " + e.getMessage());
}
但是我得到錯誤說:
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/cdi-search: Expected mime type application/octet-stream but got text/plain. #Thu Mar 23 10:00:01 UTC 2017
name.last_index_time=2017-03-23 10\:00\:01
last_index_time=2017-03-23 10\:00\:01
我改變了的contentType爲application /八位字節流。但現在的錯誤是:
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/cdi-search: Invalid version (expected 2, but 35) or the data in not in 'javabin' format
因此,您正在尋找一種方法來將'data'屬性讀入'dataimport.properties'文件中? – freedev
我的意思是我想從這個文件dataimport.properties中讀取屬性「last_index_time」。 – iwekesi
或換句話說,我該如何使用solrj來打這個api: http:// localhost:8983/solr/admin/zookeeper?detail = true&path =%2Fconfigs%2Fmy-search%2Fdataimport.properties – iwekesi