避免 lucence QueryParser Parse 异常?
在第三行,我收到诸如“IOException:读取过去的 eof”和“LookaheadSuccess:应用程序中的错误”之类的异常。 有什么办法可以避免这种情况吗?我讨厌每次执行搜索时的中断和按继续两次
注意,只有当我告诉视觉工作室向我展示即使捕获时也会抛出的异常时,我才会注意到这一点。我没有得到异常,我只是看到它们被抛出,因此每次搜索时都会出现两个(或三个)断点。该应用程序运行良好。
var searcher = new IndexSearcher(目录, true); var parser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "all", 分析器); var query = parser.Parse(text); //这里
On the 3rd line i get exceptions such as 'IOException: read past eof' and 'LookaheadSuccess: Error in the application.'
Is there any way to avoid this? i hate the breaks and pressing continue twice everytime i execute a search
Note i only notice this when i tell visual studios to show me exceptions that are thrown even IF they are caught. I don't get the exceptions, i just see that they are being thrown thus the two (or three) breakpoints every time i search. The app runs fine.
var searcher = new IndexSearcher(directory, true);
var parser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "all", analyzer);
var query = parser.Parse(text); //here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这些是 Lucene 中发生并捕获的第一次机会异常。您已将 Visual Studio 配置为在所有异常发生时中断,而不仅仅是未处理的异常。使用“例外”对话框 (ctrl-alt-e iirc) 并更改您的设置。
These are first-chance exceptions that occur, and are caught, within Lucene. You've configured Visual Studio to break on all exceptions, and not just those that are unhandled. Use the Exceptions dialog (ctrl-alt-e iirc) and change your settings.
Lucene.NET(版本 3.0.3 时)使用 IOException 来管理解析器流程的多个部分。这对性能产生了不良影响(在我的开发机器上高达 90 毫秒)。
好消息是,该版本当前位于 http://lucenenet.apache.org/community 的源代码存储库中。 html 似乎已经删除了导致此问题的特定异常。当然对我来说,这大大提高了性能。希望这有帮助。
Lucene.NET (at the time of version 3.0.3) used IOExceptions to manage several parts of the parser's flow. This had a bad impact on the performance (up to 90ms on my development machine).
Good news is that the version currently in their source code repository at http://lucenenet.apache.org/community.html seems to have removed the specific exceptions that were causing this. Certainly for me, this has improved performance a lot. Hope this helps.
为 Lucene 3.0.3 中的 QueryParser 打补丁,以避免抛出 LookaheadSuccess 异常:
为 Lucene 3.0.3 中的 QueryParser 打补丁,以避免抛出大量 System.IO.IOException 异常:
CharStream .cs:
FastCharStream.cs:
QueryParserTokenManager.cs:
您也可以使用我的github版本
https://github.com/franckspike/lucenenet.git
Patch for QueryParser in Lucene 3.0.3 to avoid the LookaheadSuccess exception throwing:
Patch for QueryParser in Lucene 3.0.3 to avoid lots of System.IO.IOException exception throwing:
CharStream.cs:
FastCharStream.cs:
QueryParserTokenManager.cs:
You can also use my github version
https://github.com/franckspike/lucenenet.git