热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

是否有快速,准确的Lucene荧光笔?-Isthereafast,accurateHighlighterforLucene?

Ivebeenusingthe(Java)HighlighterforLucene(intheSandboxpackage)forsometime.However,t

I've been using the (Java) Highlighter for Lucene (in the Sandbox package) for some time. However, this isn't really very accurate when it comes to matching the correct terms in search results - it works well for simple queries, for example searching for two separate words will highlight both code fragments in the results.

我已经使用(Java)Highlighter for Lucene(在Sandbox包中)一段时间了。但是,在匹配搜索结果中的正确术语时,这并不是非常准确 - 它适用于简单查询,例如,搜索两个单独的单词将突出显示结果中的两个代码片段。

However, it doesn't act well with more complicated queries. In the simplest case, phrase queries such as "Stack Overflow" will match all occurrences of Stack or Overflow in the highlighting, which gives the impression to the user that it isn't working very well.

但是,对于更复杂的查询,它不能很好地运行。在最简单的情况下,诸如“Stack Overflow”之类的短语查询将匹配突出显示中所有出现的Stack或Overflow,这给用户留下了不能很好地工作的印象。

I tried applying the fix here but that came with a lot of performance caveats, and at the end of the day was just plain unusable. The performance is especially an issue on wildcard queries. This is due to the way that the highlighting works; instead of just working on the querystring and the text it parses it as Lucene would and then looks for all the matches that Lucene has made; unfortunately this means that for certain wildcard queries it can be looking for matches to 2000+ clauses on large documents, and it's simply not fast enough.

我尝试在这里应用修复程序,但这带来了很多性能警告,并且在一天结束时只是普遍无法使用。性能尤其是通配符查询的问题。这是由于突出显示的工作方式;它不是仅仅处理查询字符串和文本,而是像Lucene那样解析它,然后查找Lucene所做的所有匹配;不幸的是,这意味着对于某些通配符查询,它可以在大型文档上查找与2000+子句的匹配,并且它的速度不够快。

Is there any faster implementation of an accurate highlighter?

有没有更快的实现准确的荧光笔?

3 个解决方案

#1


2  

There is a new faster highlighter (needs to be patched in but will be part of release 2.9)

有一个新的更快的荧光笔(需要修补但将成为2.9版的一部分)

https://issues.apache.org/jira/browse/LUCENE-1522

and a back-reference to this question

并且对这个问题的反向引用

#2


1  

You could look into using Solr. http://lucene.apache.org/solr

你可以考虑使用Solr。 http://lucene.apache.org/solr

Solr is a sort of generic search application that uses Lucene and supports highlighting. It's possible that the highlighting in Solr is usable as an API outside of Solr. You could also look at how Solr does it for inspiration.

Solr是一种使用Lucene并支持突出显示的通用搜索应用程序。 Solr中的突出显示可能可用作Solr之外的API。您还可以看看Solr如何为灵感做到这一点。

#3


1  

I've been reading on the subject and came across spanQuery which would return to you the span of the matched term or terms in the field that matched.

我一直在阅读这个主题,并遇到了spanQuery,它将返回匹配字段中匹配的术语或术语的范围。


推荐阅读
author-avatar
Ray依依
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有