集成 Lucene Index 和 Amazon AWS

我有一个现有的 lucene 索引文件索引和用于执行搜索功能的 java 代码.

I have a an existing index of lucene index files and the java code to perform search functions on it.

我想做的是在服务器上执行相同的操作,这样应用程序的用户可以简单地传递一个查询,该查询将被 java 程序作为输入参数,并针对现有索引运行它以返回文档它发生在哪里.

What I would like to do is perform the same thing on a server so users of an app could simply pass a query that will be taken as an input parameter by the java program and run it against the existing index to return the document in which it occurs.

所有实现都在我的本地电脑上测试过,但我需要做的是在 Android 应用中实现它.

All the implementation has been tested on my local pc,but what I need to do is implement it in an Android app.

到目前为止,我已经阅读并得出结论,将代码移植到 AWS lambda 中并使用 S3 存储文件并从 lambda 调用 s3 对象.

So far I have read around and concluded that porting the code in AWS lambda and using S3 to store the files and calling the s3 objects from lambda.

这是正确的方法吗?任何指向这种方法或替代建议的资源也值得赞赏.

Is this the right approach?Any resources that point to the this approach or alternative suggestions are also appreciated.

提前致谢.

推荐答案

每次您的 Android 应用程序向 AWS Lambda 发送请求(我假设是通过 AWS API Gateway)时,Lambda 函数都必须将整个索引文件从 S3 下载到Lambda/tmp 目录(其中 Lambda 有 512MB 限制)然后对该索引文件执行搜索.这似乎效率极低,并且根据您的索引文件的大​​小,它可能会执行得非常糟糕,甚至可能不适合您在 Lambda 上的可用空间.

Every time your Android app sends a request to AWS Lambda (via AWS API Gateway I assume) the Lambda function will have to download the entire index file from S3 to the Lambda /tmp directory (where Lambda has a 512MB limit) and then perform a search against that index file. This seems extremely inefficient, and depending on how large your index file is, it might perform terribly or it might not even fit into the space you have available on Lambda.

我建议查看 AWS Elasticsearch Service.这是一个基于 Lucene 的完全托管的搜索引擎服务,您应该能够直接从您的 Android 应用程序中查询.

I would suggest looking into the AWS Elasticsearch Service. This is a fully managed search engine service, based on Lucene, that you should be able to query directly from your Android application.

相关文章