手机版
你好,游客 登录 注册
背景:
阅读新闻

MongoDB 核心将支持全文搜索功能 (2.3.2)

[日期:2012-12-26] 来源:oschina.net  作者:Linux [字体:大 中 小]

来自 MongoDB 官方 JIRA 的一个新特性报告称 MongoDB 将在 2.3.2 版本中增加全文搜索功能。该功能还是体验到阶段,使用方法包括:

db.adminCommand( { setParameter : "*", textSearchEnabled : true } );

或者是:

./mongod --setParameter textSearchEnabled=true

特性:

  • parsing + stemming for latin languages
  • multi-word scoring
  • phrase matching
  • word negation
  • weights per field
  • additional suffix index fields for coverings
  • additional prefix index fields for partitioning
  • specify language per document

简单使用示例:

> db.foo.insert( { _id: 1 , desc: "the dog is running" } )
> db.foo.insert( { _id: 2 , desc: "the cat is walking" } )
> db.foo.ensureIndex( { "desc": "text" } )
> db.foo.runCommand( "text", { search : "walk" } )
{
"queryDebugString" : "walk||||||",
"language" : "english",
"results" : [
{
"score" : 0.75,
"obj" : {
"_id" : 2,
"desc" : "the cat is walking"
}
}
],
"stats" : {
"nscanned" : 1,
"nscannedObjects" : 0,
"n" : 1,
"timeMicros" : 330
},
"ok" : 1
}
linux
相关资讯       MongoDB 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款