是什么导致Lucene使用Luke "<field> indexed without position data"错误?



我正在尝试从使用Lucene索引的文档中搜索DOI字段。DOI的值看起来像这样"10.1186/1756-305-7-73"。请原谅,以防这个问题很愚蠢,但这是我第一次涉足Lucene。

错误为:

〔2019-02-05 17:37:18233〕错误(ExceptionHandler.java:36)-字段"doi"在没有位置数据的情况下被索引;无法运行PhraseQuery(phrase=doi:"10.1186 s12937 015 0065 5")java.lang.IollegalStateException:字段"doi"在没有位置数据的情况下被索引;无法运行PhraseQuery(phrase=doi:"10.1186 s12937 015 0065 5")

问题的详细信息:

  • Lucene版本-7
  • 查询表达式-doi:"10.1186/1756-305-7-73">
  • 解析查询-doi:"10.1186 1756 3305 7 73"(注意它删除了正斜杠和连字符)
  • 分析仪试用-英语分析仪,标准分析仪,简单分析仪
  • 用于导航Lucene索引的软件-Luke v7.6.0

不,我没有错。字段"DOI"的值已经使用Lucene进行了索引。

以下是错误的完整日志:

〔2019-02-05 17:37:18233〕错误(ExceptionHandler.java:36)-字段"doi"在没有位置数据的情况下被索引;无法运行PhraseQuery(phrase=doi:"10.1186 s12937 015 0065 5")java.lang.IollegalStateException:字段"doi"在没有位置数据的情况下被索引;无法运行PhraseQuery(phrase=doi:"10.1186 s12937 015 0065 5")网址:org.apache.locene.search.PraseQuery$1.getPhraseMatcher(PhraseQuery.java:434)网址:org.apache.locene.search.PraseWeight.strager(PhraseWeight.java:46)网址:org.apache.locene.search.Weight.bulkScorer(Weight.java:177)网址:org.apache.locene.search.IndexSearcher.search(IndexSearcher.java:667)网址:org.apache.locene.search.IndexSearcher.search(IndexSearcher.java:471)网址:org.apache.locene.search.IndexSearcher.search(IndexSearcher.java:592)网址:org.apache.locene.search.IndexSearcher.searchAfter(IndexSearcher.java:447)网址:org.apache.locene.luke.models.search.SearchImpl.search(SearchImpl.java:283)网址:org.apache.locene.luke.models.search.SearchImpl.search(SearchImpl.java:273)网址:org.apache.locene.luke.app.desktop.components.SearchPanelProvider.doSearch(SearchPanelProvider.java:516)网址:org.apache.locene.luke.app.desktop.components.SearchPanelProvider.access$500(SearchPanelProvider.java:93)网址:org.apache.locene.luke.app.desktop.components.SearchPanelProvider$ListenerFunctions.execSearch(SearchPanelProvider.java:672)在javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)在javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)在javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)位于javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)位于javax.swing.plaf.basic.BasicButtonListener.mouseRelease(BasicButton Listener.java:252)位于java.awt.Component.processMouseEvent(Component.java:6539)位于javax.swing.JComponent.processMouseEvent(JComponent.java:3324)位于java.awt.Component.processEvent(Component.java:6304)位于java.awt.Container.processEvent(Container.java:2239)位于java.awt.Component.dispatchEventImpl(Component.java:4889)位于java.awt.Container.dispatchEventImpl(Container.java:2297)位于java.awt.Component.dispatchEvent(Component.java:4711)位于java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)位于java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)位于java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)位于java.awt.Container.dispatchEventImpl(Container.java:2283)位于java.awt.Window.dispatchEventImpl(Window.java:2746)位于java.awt.Component.dispatchEvent(Component.java:4711)位于java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)在java.awt.EventQueue.access$500(EventQueue.java:97)位于java.awt.EventQueue$3.run(EventQueue.java:709)位于java.awt.EventQueue$3.run(EventQueue.java:703)位于java.security.AccessController.doPrivileged(本机方法)在java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)位于java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)位于java.awt.EventQueue$4.run(EventQueue.java:733)位于java.awt.EventQueue$4.run(EventQueue.java:731)位于java.security.AccessController.doPrivileged(本机方法)在java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)位于java.awt.EventQueue.dispatchEvent(EventQueue.java:730)在java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)位于java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)位于java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)位于java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)位于java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)在java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

我确实有一种直觉,这里的错误与解析查询表达式有关。我确实注意到-和/是从我的原始查询中解析出来的,但我不知道如何解决这个问题。如有任何指示,我们将不胜感激。

危险!!经过一整天的努力,我找到了答案。

不能将标准分析器、简单分析器或英语分析器与唯一标识符类型查询一起使用。它们解析或修剪重要的关键字符号,如连字符和/或正斜杠。

因此,我将Keyword Analyser jar导入Luke中,并使用它搜索查询表达式

关键字分析器从这里下载并导入到Luke中。

最新更新