Sitecore Lucene 索引目录存在,但没有段文件
按照此 SDN 文档中的说明进行操作(PDF),我向 Sitecore 6.3 网站添加了自定义 Lucene 索引(或者我是这么认为的):
- 在
web.config
部分>,我添加了索引定义:
<indexes> ... <index id="website" singleInstance="true" type="Sitecore.Data.Indexing.Index, Sitecore.Kernel"> <param desc="name">$(id)</param> <fields hint="raw:AddField"> <field target="created">__created</field> <field target="name">@name</field> <field target="body">body</field> <field target="template" storage="keyword">@tid</field> <field target="id" storage="unindexed">@id</field> </fields> </index> </indexes>
- 我将索引添加到了
master
数据库:
<database id="master" ...> ... <indexes hint="list:AddIndex"> ... <index path="indexes/index[@id='website']" /> </indexes> </database>
- 由于
master
数据库已经设置了HistoryEngine
(默认情况下),我没有进行任何额外的配置更改。
我可以验证 system
索引是否已正确填充,因为 Sitecore 桌面中的搜索应用程序能够查找项目,并且 ~/Data/indexes/master/system
目录中充满了 Lucene 索引文件。
但是,虽然 ~/Data/indexes/master/website
目录是自动创建的,但其中没有索引文件,并且尝试在我的子布局中执行搜索会出现以下系统.IO.FileNotFoundException
(为简单起见,缩写路径):
在 Sitecore.Data.Indexing.FSDirectory@~/Data/indexes/master/website: 文件中找不到段* 文件:
我需要进行哪些其他更改才能让 Sitecore 识别新索引?
Following the instructions in this SDN document (PDF), I added a custom Lucene index to a Sitecore 6.3 website (or so I thought):
- In the
<indexes>
section inweb.config
, I added my index definition:
<indexes> ... <index id="website" singleInstance="true" type="Sitecore.Data.Indexing.Index, Sitecore.Kernel"> <param desc="name">$(id)</param> <fields hint="raw:AddField"> <field target="created">__created</field> <field target="name">@name</field> <field target="body">body</field> <field target="template" storage="keyword">@tid</field> <field target="id" storage="unindexed">@id</field> </fields> </index> </indexes>
- I added the index to the
master
database:
<database id="master" ...> ... <indexes hint="list:AddIndex"> ... <index path="indexes/index[@id='website']" /> </indexes> </database>
- Since the
master
database already hasHistoryEngine
set up (by default), I did not make any additional configuration changes.
I can verify that the system
index is getting populated correctly, as the search application in the Sitecore Desktop is able to find items, and the ~/Data/indexes/master/system
directory is chock full of Lucene index files.
However, although the ~/Data/indexes/master/website
directory was created automatically, there are no index files in it, and attempting to perform a search in my sublayout results in the following System.IO.FileNotFoundException
(path abbreviated for simplicity):
no segments* file found in Sitecore.Data.Indexing.FSDirectory@~/Data/indexes/master/website: files:
What additional changes do I need to make to get Sitecore to recognize the new index?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过更多的实验/研究后,我发现实际上不需要额外的配置。
按照这篇博文中的说明,我只需重建主数据库的搜索索引,一切就开始工作了!
不过,我必须密切关注它;我认为搜索索引会每 5 分钟自动更新一次(基于
Indexing.UpdateInterval
设置的值)。After doing more some experimentation/research, I discovered that there was actually no additional configuration necessary.
Following the instructions in this blog post, I simply rebuilt the search index for the master database, and everything started working!
I will have to keep an eye on it, though; I thought the search index would be updated automatically every 5 minutes (based on the value of the
Indexing.UpdateInterval
setting).