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里面实现 ...
随机推荐
- Java异常&&RuntimeException异常
Java异常可分为3种: (1)编译时异常:Java.lang.Exception (2)运行期异常:Java.lang.RuntimeException (3)错误:Java.lang.Error ...
- cmd 批处理文件(.bat)文件的编写
1. 获取当前文件所在的路径信息 CMD获取当前目录的绝对路径 创建如下的名为 test.bat的文本文件: @echo off echo 当前盘符:%~d0 echo 当前盘符和路径:%~dp0 e ...
- PCB Genesis脚本 C#调用Python
在PCB行业,Genesis的二次开发的编程脚本越来越丰富了啊,从一开始进入眼界的Genesis脚本语言是很少的,CSH,PERL, 再后来慢慢发展,VB,易语言,VB.NET,C#,Java,TCL ...
- poj1200Crazy Search(hash)
题目大意 将一个字符串分成长度为N的字串.且不同的字符不会超过NC个.问总共有多少个不同的子串. /* 字符串hash O(n)枚举起点 然后O(1)查询子串hash值 然后O(n)找不一样的个数 ...
- python 画图
1.根据实际图形,用符号画出原来图形 from PIL import Image import argparse #命令行输入参数处理 parser = argparse.ArgumentParser ...
- 51nod 1340 差分约束
思路: 带未知量的Floyd 很强 http://yousiki.net/index.php/archives/87/ //By SiriusRen #include <bits/stdc++. ...
- [ SCOI 2009 ] 最长距离
\(\\\) \(Description\) 一个\(N\times M\)的网格图中有一些坏点,图是四联通的. 你至多可以拿走\(K\)个坏点,求拿走后联通的点对中欧几里得距离最大是多少. \(N, ...
- [转]Wote用python语言写的imgHash.py
#!/usr/bin/python import glob import os import sys from PIL import Image EXTS = 'jpg', 'jpeg', 'JPG' ...
- Android studio & SDK的国内有效站点。
SDK.TOOLS的国内有效镜像节点: mirrors.zzu.edu.cn/android/repository/ 网上的地址只写了mirrors.zzu.edu.cn,有误,需要补齐后面的子目录才 ...
- css图片特效
网站图片往往有很多显示效果,使用css是实现图片特效的比较简便的方式.下面记录一段css鼠标指向的多重特效: <!DOCTYPE html><html lang="en&q ...