什么是Google App Engine最好的Java文本索引库?

use*_*726 7 java google-app-engine full-text-indexing

到目前为止,我知道指南针可以处理这项工作.但使用罗盘索引看起来相当昂贵.有没有更轻的替代品?

Pas*_*ent 6

说实话,我不知道Lucene在索引方面是否比指南针更轻(为什么会这样,Compass不会使用Lucene?).

无论如何,因为你要求替代品,有GAELucene.我在下面引用它的公告:

通过讨论启发" 我可以在谷歌应用引擎中运行Lucene吗? ",我实施了一个基于谷歌数据存储的Lucene组件GAELucene,它可以帮助您在谷歌应用引擎上运行搜索应用程序.

GAELucene的主要内容包括:

  • GAEDirectory - 基于Google数据存储区的只读目录.
  • GAEFile - 代表索引文件,文件的字节内容将被分割为多GAEFileContent.
  • GAEFileContent - 代表索引文件的一部分.
  • GAECategory - 不同指数的标识符.
  • GAEIndexInput - 内存驻留的IndexInput?像RAMInputStream这样的实现.
  • GAEIndexReader - IndexReader的包装器?缓存在GAEIndexReaderPool中
  • GAEIndexReaderPool - GAEIndexReader的池

以下代码片段演示了如何使用GAELucene进行搜索:

Query queryObject = parserQuery(request);
GAEIndexReaderPool readerPool = GAEIndexReaderPool.getInstance();
GAEIndexReader indexReader = readerPool.borrowReader(INDEX_CATEGORY_DEMO);
IndexSearcher searcher = newIndexSearcher(indexReader);
Hits hits = searcher.search(queryObject);
readerPool.returnReader(indexReader);
Run Code Online (Sandbox Code Playgroud)

我热烈建议阅读有关nabble的整个讨论,内容非常丰富.

关于Compass,Shay Banon撰写了一篇博客文章,详细介绍了如何在App Engine中使用Compass:http://www.kimchy.org/searchable-google-appengine-with-compass/


Asa*_*aph 4

Apache Lucene是 Java 全文索引的事实上的选择。看起来Compass Core包含“Lucene Directory 的实现,用于在数据库中存储索引(使用 Jdbc)。它与 Compass 代码库分离,可以与纯 Lucene 应用程序一起使用。” 加上大量其他东西。您可以尝试仅分离 Lucence 组件,从而剥离多个库并使其更加轻量级。要么完全放弃 Compass,而使用纯粹的、未经修饰的 Lucene。