相关文章: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全文索引的更多相关文章

  1. mongodb索引 全文索引使用限制

    全文索引非常强大,但是同样存在很多限制,我们来看以下去全文索引的使用限制: 1.每次查询,只能指定一个$text查询 2.$text查询不能出现在$nor查询中 之前没有接触过$nor查询,$nor查 ...

  2. mongodb搭建和基本语法

    下载安装包 https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.0.0-signed.msi?_ga=1.2206 ...

  3. MongoDB索引介绍

    MongoDB中的索引其实类似于关系型数据库,都是为了提高查询和排序的效率的,并且实现原理也基本一致.由于集合中的键(字段)可以是普通数据类型,也可以是子文档.MongoDB可以在各种类型的键上创建索 ...

  4. MongoDB实用教程

    ---------------------------------------------------------------------------------------------------- ...

  5. MongoDB索引的种类与使用

    一:索引的种类 1:_id索引:是绝大多数集合默认建立的索引,对于每个插入的数据,MongoDB都会自动生成一条唯一的_id字段2:单键索引: 1.单键索引是最普通的索引 2.与_id索引不同,单键索 ...

  6. mongodb的基本操作数据更新

    先启动服务器 查看数据库 选择数据库 删除数据库 插入信息 查看插入的表名 查看信息 修改表数据 修改指定信息,其他信息不改变 可以使不存在的命令进行修改并保存 修改多条数据 删除数据 删除表 查看集 ...

  7. 3、mongoDB索引

    创建索引: db.imooc_collection.getIndexes() 查看索引情况 db.imooc_collection.ensureIndex({x:1}) 创建索引,x:1代表正向排序, ...

  8. 玩转mongodb(七):索引,速度的引领(全文索引、地理空间索引)

    本篇博文主要介绍MongoDB中一些常用的特殊索引类型,主要包括: 用于简单字符串搜索的全文本索引: 用于球体空间(2dsphere)和二维平面(2d)的地理空间索引. 一.全文索引 MongoDB有 ...

  9. MongoDB(课时24 全文索引)

    3.6.3 全文索引 在一些信息管理平台上经常需要进行信息模糊查询,最早的时候是利用了某个字段上实现的模糊查询,但这个时候返回的信息并不会很准确,因为只能够查A字段或B字段,而在MongoDB里面实现 ...

随机推荐

  1. [Supervisor]supervisor监管gunicorn启动DjangoWeb时异常退出

    一开始配置 [program:django_web] command=gunicorn -w 4 -b 0.0.0.0:8080 superadmin.wsgi:application directo ...

  2. [HNOI2011]XOR与路径

    https://zybuluo.com/mdeditor#1094266 标签(空格分隔): 高斯消元 期望 题面 从 1 号节点开始,以相等的概率,随机选择与当前节点相关联的某条边,并沿这条边走到下 ...

  3. bzoj1607 [Usaco2008 Dec]Patting Heads 轻拍牛头——暴力

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1607 观察一下数据范围,就是纯粹的暴力. 代码如下: #include<iostrea ...

  4. 03_jni_helloworld_完成

    通过ndk-build编译C的代码.cd /d就是直接进到我的目录里面. 打开ANDROID-MK.HTML Introduction: This document describes the syn ...

  5. Git学习之序

    最近在忙毕业论文的事,需要用NS2仿真,其中需要修改NS2的源码,故想藉此机会学习一下Git,方便代码的管理. 由于我在以前实习的时候接触过代码管理工具SVN,因此对代码管理的一些概念还是有的.如果从 ...

  6. ACM_最值差(线段树区间查询最值)

    最值差 Time Limit: 2000/1000ms (Java/Others) Problem Description: 给定N个数A1A2A3A4...AN.求任意区间Ai到Aj中的最大数与最小 ...

  7. mysql触发器的操作

    一.创建触发器 1.创建有一条执行语句的触发器 CREATE TRIGGER trigger_name BEFORE|AFTER trigger_EVENT(INSERT|DELETE|UPDATE) ...

  8. [转]linux之patch命令

    转自:http://blog.chinaunix.net/uid-9525959-id-2001542.html patch [选项] [原始文件 [补丁文件]] [功能] 给文件1应用补丁文件变成另 ...

  9. Html基础学习(基于W3school网络教程)

    //防止乱码 head中加入 <meta http-equiv="Content-Type" content="text/html; charset=utf-8&q ...

  10. JS——轮播图简单版

    1.小图标版本 <!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...