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

时间:2010-01-03 18:32:51

标签: java google-app-engine full-text-indexing

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

5 个答案:

答案 0 :(得分:6)

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

无论如何,因为你要求替代方案,有GAELucene。我在下面引用its announcement

  

讨论“Can I run Lucene in google app engine?”启发,   我实施了基于Google数据存储区   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);

我热烈建议阅读关于讨论的整个讨论,非常有用。

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

答案 1 :(得分:4)

Apache Lucene是Java中全文索引的事实上的选择。看起来Compass Core包含“Lucene Directory的实现,用于将索引存储在数据库中(使用Jdbc)。它与Compass代码库分离,可以与纯Lucene应用程序一起使用。”加上其他的东西。您可以尝试仅分离Lucence组件,从而剥离几个库并使其更轻量级。无论是那个还是沟渠Compass完全使用纯粹朴素的Lucene。

答案 2 :(得分:1)

对于Google App Engine,我见过的唯一索引库是appengine-search,其中介绍了如何在this page上使用它。我没有尝试过。

我使用了Lucene(Compass所依据的)并且发现它在相对较低的费用下运行良好。索引是一项任务,您可以按照您的应用程序的时间安排。

this SO thread中提到了一些替代索引项目,包括Xapianminion。我没有检查过这些,因为Lucene做了我需要的所有东西。

答案 3 :(得分:0)

Google App引擎内部搜索似乎更好,甚至还支持同义词:

https://developers.google.com/appengine/docs/java/search/

答案 4 :(得分:0)

如果您想在GAE上运行Lucene,您可能还需要查看LuGAEne。这是Lucene对GAE的Directory的实现。

用法实际上非常简单,只需用GaeDirectory

替换Lucene的标准目录之一
Directory directory = new GaeDirectory("MyIndex");
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_43);
IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_43, analyzer);
IndexWriter writer = new IndexWriter(directory, config);
...

gaelucene似乎处于“维护模式”(自2009年9月以来没有提交),并且当您在应用程序中使用lucene-appengine版本4时,Objectify仍然无法正常工作

免责声明:我是LuGAEne的作者。