Cassandra 全文搜索就像
假设我有一个名为 Questions 的列族,如下所示: 问题 = {
你是谁:{ 用户名:“user1” }, 答案是什么:{ 用户名:“user1” }... }
如何搜索包含特定单词的所有问题? 获取所有包含“what”一词的问题。 我如何使用 python 或者至少 Java 来做到这一点?
Let's say I have a column family named Questions like below:
Questions = {
Who are you: {
username: "user1"
}, What is the answer: {
username: "user1"
}...
}
How do I search for all the questions that contain certain words?
Get all questions that contain 'what' word.
How do I do it using python or at least Java?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我是 Cassandra 的新手,但与关系数据库等相比,其中的查询相对有限。 (这是设计使然。)我很确定目前不支持全文搜索(这甚至可能不在路线图上)。
您可能最好使用 Lucene 或类似的工具来索引问题文本,无论是在 Cassandra 数据存储中还是在单独的数据存储中。
似乎至少有一个项目正在尝试将 Lucene 与 Cassandra 集成,并且可能还有其他项目:
对于您的情况,另一种方法可能是将问题分解为单词并维护您自己的问题单词索引;你的情况可能会有所不同,像 Lucene 这样的东西无疑会给你更大的查询灵活性。
I'm new to Cassandra, but querying in it is relatively limited, compared to, for instance, a relational database. (This is by design.) I'm pretty sure there's no support for full text search at this time (this may not even be on the roadmap).
You might be best to go with Lucene or something comparable to index the text of the questions, either within the Cassandra datastore or in a separate datastore.
There appears to be at least one project that is attempting to integrate Lucene with Cassandra, and there may be others:
Another way to go in your case might be to break up the questions into words and maintain your own index of words to questions; your mileage may vary here, and something like Lucene will no doubt give you greater flexibility in querying.
听起来你可以添加来自支持 Cassandra 的人们的“DSE 搜索”,然后你就会得到你需要的东西。 Lucene/Solr 类似功能,但所有数据都存储在 Cassandra 中。
http://www.datastax.com/dev/blog/cassandra -with-solr-integration-details
上一位代理给了你一个很好的解决方案,但从可用性的角度来看,这个解决方案可能会更好地满足你的目的。
免责声明:我为 NoSQL 供应商工作,但不在 Cassandra 上工作。
Sounds like you could add "DSE Search", from the folks that support Cassandra, and you would have what you need. Lucene/Solr like capabilities but all the data stored in Cassandra.
http://www.datastax.com/dev/blog/cassandra-with-solr-integration-details
You have a good solution given by the last gent but this solution may serve your purpose better from a usability point of view.
Disclaimer: I work for a NoSQL vendor but not on Cassandra.
Solandra (https://github.com/tjake/Solandra) 是 Lucandra 的新名称。
Solandra 是 Cassandra 和 Solr(基于 Lucene 全文搜索引擎)的组合。
尽管您可以通过创建二级索引列族(Google:cassandra二级索引)来实现一些基本的文本索引,但 Cassandra 本身并不能解决文本搜索问题。
Solandra (https://github.com/tjake/Solandra) is the new name for Lucandra.
Solandra is a combination of Cassandra and Solr (which is based on the Lucene full-text search engine).
Cassandra alone doesn't tackle text-search, although you could implement some basic text indexing by creating secondary index column families (Google: cassandra secondary index).