简体   繁体   中英

Solr delay at document delete

也许有人遇到了与我相同的问题,可以为我提供帮助,当我删除文档时,solr索引刷新之间会有延迟,而我仍然停留在列表文档中,该文档只是提前删除了Thans

It looks like you are using SolrJ UpdateRequest to delete the document. Since you are not explicitly committing the update, the actual timing of index update depends on your Solr configuration. From Solr docs ( https://cwiki.apache.org/confluence/display/solr/Near+Real+Time+Searching )

"A common configuration is to do a hard autocommit every 1-10 minutes and a autosoftcommit every second"

If you need to make the delete committed to index right away, you can add "COMMIT" action to your UpdateRequest like this:

UpdateRequest req = new UpdateRequest();
req.deleteByQuery("documentId:"documentId);
req.setAction(ACTION.COMMIT, false, true);

this will have the same effect as adding "?action=commit" to your update request and will perform a soft commit right away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM