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

发布于 2024-08-16 20:25:42 字数 51 浏览 5 评论 0原文

目前我知道指南针可以处理这项工作。但用指南针建立索引看起来相当昂贵。有没有更轻的替代品?

To the moment I know that compass may handle this work. But indexing with compass looks pretty expensive. Is there any lighter alternatives?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

〃安静 2024-08-23 20:25:42

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

无论如何,因为您要求替代方案,所以有 GAELucene。我在下面引用了其公告 :

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

GAELucene的主要内容包括:

  • GAEDirectory - 基于 Google 数据存储的只读目录。
  • GAEFile - 代表索引文件,文件的字节内容将是
    分成多个GAEFileContent。
  • GAEFileContent - 代表索引文件的一段。
  • GAECategory - 不同索引的标识符。
  • GAEIndexInput - 内存驻留 IndexInput?实施像
    RAM输入流。
  • GAEIndexReader - IndexReader 的包装器?缓存在
    GAEIndexReaderPool
  • GAEIndexReaderPool - GAEIndexReader 池

下面的代码片段
演示了使用GAELucene做
搜索:

查询 queryObject = parserQuery(request);
GAEIndexReaderPool readerPool = GAEIndexReaderPool.getInstance();
GAEIndexReader indexReader = readerPool.borrowReader(INDEX_CATEGORY_DEMO);
IndexSearcher 搜索器 = newIndexSearcher(indexReader);
点击次数 hits = searcher.search(queryObject);
readerPool.returnReader(indexReader);

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

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

To be honest, I don't know if Lucene will be lighter than Compass in terms of indexing (why would it be, doesn't Compass use Lucene for that?).

Anyway, because you asked for alternatives, there is GAELucene. I'm quoting its announcement below:

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);

I warmly recommend to read the whole discussion on nabble, very informative.

Just in case, regarding Compass, Shay Banon wrote a blog entry detailing how to use Compass in App Engine here: http://www.kimchy.org/searchable-google-appengine-with-compass/

孤檠 2024-08-23 20:25:42

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

Apache Lucene is the de-facto choice for full text indexing in Java. Looks like Compass Core contains "An implementation of Lucene Directory to store the index within a database (using Jdbc). It is separated from Compass code base and can be used with pure Lucene applications." plus tons of other stuff. You could try to separate just the Lucence component thereby stripping away several libs and making it more lightweight. Either that or ditch Compass altogether and use pure unadorned Lucene.

花桑 2024-08-23 20:25:42

对于 Google App Engine,我见过的唯一索引库是 appengine-search,带有关于如何在此页面< /a>.不过我还没有尝试过。

我使用过 Lucene (Compass 所基于的)并发现它可以很好地工作费用相对较低。索引是一项您可以安排在适合您的应用程序的时间进行的任务。

这个SO线程中提到了一些替代索引项目,包括Xapian奴才。不过我还没有检查过其中任何一个,因为 Lucene 很好地完成了我需要的一切。

For Google App Engine, the only indexing library I've seen is appengine-search, with a description of how to use it on this page. I haven't tried it out though.

I've used Lucene (which Compass is based on) and found it to work great with comparatively low expense. The indexing is a task that you can schedule at times that work for your app.

Some alternatives indexing projects are mentioned in this SO thread, including Xapian and minion. I haven't checked either of these out though, since Lucene did everything I needed it to very well.

瑶笙 2024-08-23 20:25:42

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

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

The Google App engine internal search seems better, and even havsupport synonyms:

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

好倦 2024-08-23 20:25:42

如果您想在 GAE 上运行 Lucene,您还可以查看 LuGAEne。它是 Lucene 的 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< /a> 似乎处于“维护模式”(自 2009 年 9 月以来未提交)并且 lucene-appengine当您使用 Objectify 版本 4 时, 尚无法运行在您的应用程序中。

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

If you want to run Lucene on GAE you might also have a look at LuGAEne. It's an implementation of Lucene's Directory for GAE.

Usage is actually pretty simple, just replace one of Lucene's standard directories with GaeDirectory

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 seems to be in "maintenance mode" (no commit since Sep 2009) and lucene-appengine does not (yet) work when you're using Objectify version 4 in your application.

Disclaimer: I'm the author of LuGAEne.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文