目前我知道 compass 可以处理这项工作。但是用罗盘索引看起来很昂贵。有没有更轻的替代品?
最佳答案
老实说,我不知道 Lucene 在索引方面是否会比 Compass 更轻(为什么会这样,Compass 不为此使用 Lucene?)。
无论如何,因为您要求替代品,所以有 GAELucene .我在引用 its announcement下面:
Enlightened by the discussion "Can I run Lucene in google app engine?", I implemented a google datastore based Lucene component, GAELucene, which can help you to run search applications on google app engine.
The main clazz of GAELucene include:
- GAEDirectory - a read only Directory based on google datastore.
- GAEFile - stands for an index file, the file's byte content will be splited into multi GAEFileContent.
- GAEFileContent - stands for a segment of index file.
- GAECategory - the identifier of different indices.
- GAEIndexInput - a memory-resident IndexInput? implementation like the RAMInputStream.
- GAEIndexReader - wrapper for IndexReader? that cached in GAEIndexReaderPool
- GAEIndexReaderPool - pool for GAEIndexReader
The following code snippet demonstrates the use of GAELucene do searching:
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);
我强烈建议阅读有关 nabble 的整个讨论,内容非常丰富。
为了以防万一,关于 Compass,Shay Banon 在这里写了一篇博客文章,详细介绍了如何在 App Engine 中使用 Compass:http://www.kimchy.org/searchable-google-appengine-with-compass/
关于java - 适用于 Google App Engine 的最佳 Java 文本索引库是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1995826/