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里面实现 ...
随机推荐
- yistack
- openstack 虚拟机导出
- sql数据库CHECKDB时报x个分配错误和x个一致性错误
--1.在SQL查询分析器中执行以下语句:(注以下所用的POS为数据库名称,请用户手工改为自己的数据库名) use pos dbcc checkdb --2.查看查询结果,有很多红色字体显示,最后结果 ...
- 分享一些对IT人员非常好用的资源
前言 分享一下本人工作至今整理的一些好用的资源,这些资源主要是一些工作和生活中用到的文档.软件和网站. 文档主要是面试相关的文档和技术文档,其中面试文档主要是Java这块的,技术文档就有很多,除了Ja ...
- 微信小程序的wxml文件和wxss文件在webstrom的支持
webstrom默认不支持wxml文件和wxss文件,所以要进入设置里面手动添加支持. 对wxml文件的支持: 文件 -> 设置 -> 编辑器 -> 文件类型, 然后选择XML文件, ...
- ansible剧本
yaml简介 YAML是"YAML Ain't a Markup Language"(YAML不是一种置标语言)的递归缩写,早先YAML的意思其实是:"Yet Anoth ...
- pip使用豆瓣镜像源
pip使用豆瓣的镜像源 豆瓣镜像地址: https://pypi.douban.com/simple/ 虽然用easy_install和pip来安装第三方库很方便 他们的原理其实就是从Python的官 ...
- java_基础知识_字符串练习题_计算两个字符串的最长公共字串长度
package tek; Java算法——求出两个字符串的最长公共字符串 /** * @Title: 问题:有两个字符串str1和str2,求出两个字符串中最长公共字符串. * @author 匹夫( ...
- 研磨JavaScript系列(三):函数的魔力
JavaScript的代码中就只有function一种形式,function就是函数的类型.在其他的编程语言中可能还存在Procedure或者是method等代码概念,在JavaScript中只有fu ...
- [Android]异常7-Error:Configuration with name 'default' not found.
背景:使用SVN更新代码,运行出现 异常原因: 可能一>缺少Modules 解决办法有: 解决一>Android Studio切换为Project,settings.gradle中引用和现 ...