相关疑难解决方法(0)

如何将Spring Data MongoDB Query与全文搜索结合起来?

我最近升级到Spring Data MongoDB 1.6.0.RC1,非常好,并实现了MongoDB 2.6(huuurah!)的全文搜索功能.我的问题是:我如何组合Criteria和TextCriteria类来生成复杂的查询?

示例对象模型:

{
  textProperty: "a text that is indexed for full text search",
  language:"en",
  aBooleanProperty: true,
  anIntegerProperty: 1
}
Run Code Online (Sandbox Code Playgroud)

查询:

db.collection({ anIntegerProperty: 1,  $text: { $search: "indexed", $language: "en" } })
Run Code Online (Sandbox Code Playgroud)

那么,如何使用Spring Data MongoDB类编写上述查询?

search full-text-search spring-data-mongodb

4
推荐指数
1
解决办法
1万
查看次数