相关文章:php使用Coreseek实现全文索引

Introduction
Mongo provides some functionality that is useful for text search and tagging.
MongoDB提供了一些拥有的功能用于全文搜索与标记。

Multikeys (Indexing Values in an Array)多建(数组中得索引值)
The Mongo multikey feature can automatically index arrays of values.
Tagging is a good example of where this feature is useful. Suppose you
have an article object/document which is tagged with some category
names:

obj = {
name: "Apollo",
text: "Some text about Apollo moon landings", //正文
tags: [ "moon", "apollo", "spaceflight" ] //索引标记
}

and that this object is stored in db.articles. The command

db.articles.ensureIndex( { tags: 1 } );
will index all the tags on the document, and create index entries for “moon”, “apollo” and “spaceflight” for that document.

索引使用例子
You may then query on these items in the usual way:

> print(db.articles.findOne( { tags: "apollo" } ).name);

Apollo
The database creates an index entry for each item in the array. Note an
array with many elements (hundreds or thousands) can make inserts very
expensive. (Although for the example above, alternate implementations
are equally expensive.)

Text Search
It is fairly easy to implement basic full text search using multikeys.
What we recommend is having a field that has all of the keywords in it,
something like:

{ title : "this is fun" ,
_keywords : [ "this" , "is" , "fun" ]
}

Your code must split the title above into the keywords before saving. Note that this code (which is not part of Mongo DB) could do stemming, etc. too. (Perhaps someone in the community would like to write a standard module that does this…)

相关文章:php使用Coreseek实现全文索引

转载请注明:FKBlog » mongoDB全文索引(http://www.fkblog.org/blog485)

最新文章

  1. 《ES6基础教程》之 map、forEach、filter indexOf 用法
  2. NetMQ(二): 请求响应模式 Request-Reply
  3. Mac xcode 编译产生app的路径
  4. 0523 Scrum 项目6.0
  5. oracle安装,配置,启动
  6. 关于asp.net中cookie在调试过程中读写正常发布后乱码问题
  7. 沙湖王 | 用K-均值聚类给女明星们的身材分分类
  8. boost uuid 学习笔记
  9. 计蒜客 作弊揭发者(string的应用)
  10. New Year Tree 【DFS序+先段数区间查询修改+二进制保存状态】
  11. gulp 学习笔记
  12. DNA序列局部比对(Smith–Waterman algorithm)
  13. 理解Java Integer的缓存策略【转】
  14. 和scikit-learn打个招呼
  15. 【java线程】的wait、sleep、join、yied
  16. CentOS7 Nginx安装及配置反向代理
  17. Spring 基于构造函数的依赖注入
  18. day 7-12 数据库的基本操作和存储引擎
  19. Golang实现杨辉三角
  20. weblogic隐藏版本号教程(10.3.6为例)

热门文章

  1. P4166 [SCOI2007]最大土地面积
  2. [Swift通天遁地]七、数据与安全-(20)快速实现MD5/Poly1305/Aes/BlowFish/Chacha/Rabbit
  3. async 函数-----------------解决异步操作隧道的亮光
  4. RHEL6.5安装QT5.4,设置环境变量
  5. [Android]异常2-Unexpected error while executing
  6. 初学layer
  7. JS——if条件判断
  8. Caffe RPN :error C2220: warning treated as error - no 'object' file generated
  9. id 转 entity
  10. 黑苹果开启retina,大分辨率的方法