mongoDB全文索引
相关文章: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)
mongoDB全文索引的更多相关文章
- mongodb索引 全文索引使用限制
全文索引非常强大,但是同样存在很多限制,我们来看以下去全文索引的使用限制: 1.每次查询,只能指定一个$text查询 2.$text查询不能出现在$nor查询中 之前没有接触过$nor查询,$nor查 ...
- mongodb搭建和基本语法
下载安装包 https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.0.0-signed.msi?_ga=1.2206 ...
- MongoDB索引介绍
MongoDB中的索引其实类似于关系型数据库,都是为了提高查询和排序的效率的,并且实现原理也基本一致.由于集合中的键(字段)可以是普通数据类型,也可以是子文档.MongoDB可以在各种类型的键上创建索 ...
- MongoDB实用教程
---------------------------------------------------------------------------------------------------- ...
- MongoDB索引的种类与使用
一:索引的种类 1:_id索引:是绝大多数集合默认建立的索引,对于每个插入的数据,MongoDB都会自动生成一条唯一的_id字段2:单键索引: 1.单键索引是最普通的索引 2.与_id索引不同,单键索 ...
- mongodb的基本操作数据更新
先启动服务器 查看数据库 选择数据库 删除数据库 插入信息 查看插入的表名 查看信息 修改表数据 修改指定信息,其他信息不改变 可以使不存在的命令进行修改并保存 修改多条数据 删除数据 删除表 查看集 ...
- 3、mongoDB索引
创建索引: db.imooc_collection.getIndexes() 查看索引情况 db.imooc_collection.ensureIndex({x:1}) 创建索引,x:1代表正向排序, ...
- 玩转mongodb(七):索引,速度的引领(全文索引、地理空间索引)
本篇博文主要介绍MongoDB中一些常用的特殊索引类型,主要包括: 用于简单字符串搜索的全文本索引: 用于球体空间(2dsphere)和二维平面(2d)的地理空间索引. 一.全文索引 MongoDB有 ...
- MongoDB(课时24 全文索引)
3.6.3 全文索引 在一些信息管理平台上经常需要进行信息模糊查询,最早的时候是利用了某个字段上实现的模糊查询,但这个时候返回的信息并不会很准确,因为只能够查A字段或B字段,而在MongoDB里面实现 ...
随机推荐
- 让DIV在屏幕上下左右居中
转自:http://blog.sina.com.cn/s/blog_65d41dff0100v0iz.html 其实解决的思路是这样的:首们需要position:absolute;绝对定位.而层的定位 ...
- 【转载】基于AFNetWorking3.0的图片缓存分析
原文出处: Yasin的简书 理论 不喜欢理论的可以直接跳到下面的Demo实践部分 缓存介绍 缓存按照保存位置可以分为两类:内存缓存.硬盘缓存(FMDB.CoreData…).我们常说的网络请求缓存包 ...
- P4046 [JSOI2010]快递服务
传送门 很容易想出\(O(n^3m)\)的方程,三维分别表示某个快递员现在在哪里,然后直接递推即可 然而这样会T,考虑怎么优化.我们发现每一天的时候都有一个快递员的位置是确定的,即在前一天要到的位置. ...
- [App Store Connect帮助]二、 添加、编辑和删除用户(1)用户帐户和职能概述
您可以在 App Store Connect 的“用户和访问”部分管理用户.添加沙盒测试员以及管理 API 密钥. 用户职能决定了用户对 App Store Connect 和 Apple Devel ...
- JavaScript中什么是包装对象?
存取字符串.数字或布尔值的属性时,创建的临时对象称为包装对象.包装对象只是偶尔用来区分字符串值和字符串对象.数字和数值对象以及布尔值和布尔对象.由于字符串.数字和布尔值的属性都是只读的,并且不能给它们 ...
- Akka源码分析-官方文档说明
如果有小伙伴在看官方文档的时候,发现有些自相矛盾的地方,不要怀疑,可能是官方文档写错了或写的不清楚,毕竟它只能是把大部分情况描述清楚.开源代码一直在更新,官方文档有没有更新就不知道了,特别是那些官方不 ...
- Html基础学习(基于W3school网络教程)
//防止乱码 head中加入 <meta http-equiv="Content-Type" content="text/html; charset=utf-8&q ...
- JavaScript的相关知识
Oject.assign() // Cloning an object var obj = { a: 1 }; var copy = Object.assign({}, obj); conso ...
- Android studio 中R.menu的创建
对于Android开发中的menu没有声明的情况: 首先,将鼠标定位到红色的menu上面, 然后,Alt+enter组合键,建立文件menu, 然后将以下代码复制进去: <item androi ...
- VC socket api使用引入
1.在创建项目时勾上windows socket api的使用 2.头文件 #pragma comment(lib,"WS2_32.lib") 3.初始化 WSADATA dat ...