索引编制时进行Solr搜索

| 我在优化以下psedo代码时遇到问题,不胜感激
for every term 
open new index searcher
do search
if found 
skip and search for next term
else
add it to index
commit
close searcher
在上面的代码中,当向索引中添加新文档/术语时,我不得不提交仅添加新文档的更改(我觉得这很昂贵),以便看到新更改下次打开新的索引搜索器。 有什么办法可以改善性能。 仅供参考:我有3600万个术语需要索引。     
已邀请:
您可以创建一个HashSet来删除内存中术语列表的重复项,然后仅对这些术语建立索引。伪代码如下所示: 设置:=新的HashSet 每个学期   如果设置包含项     跳到下一个迭代   其他     添加条款进行设置 结束 开放指数 对于集合中的每个术语   在索引中添加术语 结束 收盘指数        
我建议您仅创建第二个索引(在临时位置的RAMDirectory或FSDirectory中)。将所有未找到的条款/文档添加到第二个(临时)索引中,并在最后合并两个索引。
open index for searching
for every term
  open new index searcher
  do search
  if found 
    skip and search for next term
  else
    add it to the second index
end
close searcher
commit temp index
merge temp index into primary index 
commit primary index
    

要回复问题请先登录注册