MongoDB全文搜索——目前尚不支持针对特定field的搜索
> db.articles.createIndex( { subject: "text" } )
{
"createdCollectionAutomatically" : true,
"numIndexesBefore" : ,
"numIndexesAfter" : ,
"ok" :
}
> db.articles.insert(
... [
... { _id: , subject: "coffee", author: "xyz", views: },
... { _id: , subject: "Coffee Shopping", author: "efg", views: },
... { _id: , subject: "Baking a cake", author: "abc", views: },
... { _id: , subject: "baking", author: "xyz", views: },
... { _id: , subject: "Caf Con Leche", author: "abc", views: },
... { _id: , subject: ".......", author: "jkl", views: },
... { _id: , subject: "coffee and cream", author: "efg", views: },
... { _id: , subject: "Cafe con Leche", author: "xyz", views: }
... ]
... )
BulkWriteResult({
"writeErrors" : [ ],
"writeConcernErrors" : [ ],
"nInserted" : ,
"nUpserted" : ,
"nMatched" : ,
"nModified" : ,
"nRemoved" : ,
"upserted" : [ ]
})
> db.articles.find( { $text: { $search: "coffee" } } )
{ "_id" : , "subject" : "Coffee Shopping", "author" : "efg", "views" : }
{ "_id" : , "subject" : "coffee and cream", "author" : "efg", "views" : }
{ "_id" : , "subject" : "coffee", "author" : "xyz", "views" : }> db.articles.find( { $text: { $search: "\"coffee shop\"" } } )
{ "_id" : , "subject" : "Coffee Shopping", "author" : "efg", "views" : }
> db.articles.find( { $text: { $search: "\"coffee\" \"shop\"" } } )
{ "_id" : , "subject" : "Coffee Shopping", "author" : "efg", "views" : }
> db.articles.find( { $text: { $search: "coffee shop" } } )
{ "_id" : , "subject" : "Coffee Shopping", "author" : "efg", "views" : }
{ "_id" : , "subject" : "coffee and cream", "author" : "efg", "views" : }
{ "_id" : , "subject" : "coffee", "author" : "xyz", "views" : }
参考:https://docs.mongodb.com/manual/reference/operator/query/text/
MongoDB全文搜索——目前尚不支持针对特定field的搜索的更多相关文章
- Lucene in action 笔记 term vector——针对特定field建立的词频向量空间,不存!不会!影响搜索,其作用是告诉我们搜索结果是“如何”匹配的,用以提供高亮、计算相似度,在VSM模型中评分计算
摘自:http://makble.com/what-is-term-vector-in-lucene given a document, find all its terms and the posi ...
- 一:cocos2dx 3.2 尚不支持cubeMap?二:光照需要shader实现
一: cocos2dx 3.2 尚不支持cubeMap? 因为需要调用cocos2dx 封装的bindTexture的方法,发现只能绑定2DTexture,对Cube_Map无能无力.顿感累觉不爱…… ...
- lucene全文搜索之四:创建索引搜索器、6种文档搜索器实现以及搜索结果分析(结合IKAnalyzer分词器的搜索器)基于lucene5.5.3
前言: 前面几章已经很详细的讲解了如何创建索引器对索引进行增删查(没有更新操作).如何管理索引目录以及如何使用分词器,上一章讲解了如何生成索引字段和创建索引文档,并把创建的索引文档保存到索引目录,到这 ...
- 安装更新时出现一些问题,但我们稍后会重试。如果你继续看到此错误,并且想要搜索 Web 或联系支持人员以获取相关信息,以下信息可能会对你有帮助: (0x80070426)
安装更新时出现一些问题,但我们稍后会重试.如果你继续看到此错误,并且想要搜索 Web 或联系支持人员以获取相关信息,以下信息可能会对你有帮助: (0x80070426) https://answers ...
- (GoRails)在导航栏增加自动的搜索功能(jquery插件:easyautocomplete)(gem 'ransack' 搜索对象4000✨)
Global Autocomplete Search 需要用到一个JQuery插件和一个搜索对象的gem EasyAutocomplete jQuery插件: https://github.com/p ...
- html小知识点汇总(浏览器导航上显示图标、div无高度时试着清除浮动、文字环绕图片、字体加粗、div按百分比分、已有的不合适的class,针对特定的标签进行修改)
1.新点击的网页,在浏览器导航上显示图标: 像这种效果: <head> <meta charset="UTF-8"> <meta name=" ...
- 【代码笔记】iOS-点击搜索按钮,或放大镜后都会弹出搜索框
一, 效果图. 二,工程图. 三,代码. RootViewController.h #import <UIKit/UIKit.h> #import "CLHSearchBar.h ...
- Microsoft Dynamics CRM 2013 --针对特定实体,取消保存功能(包含自动保存)
AutoSave 是 Microsoft Dynamics CRM 2013 一个新特性. 但AutoSave的有效范围是[所有实体],不允许针对特定某一实体进行设置. 所以,若想针对特定实体进行设置 ...
- 更新xcode后插件失效问题——不针对特定版本的通用解决方法
一.Xcode更新后插件失效的原理 1.每次更新Xcode后插件都会失效,其实插件都还在这个目录好好的躺着呢: ~/Library/Application Support/Developer/Shar ...
随机推荐
- mySQL--找出各科最高成绩
//找出各科最高成绩create table gradeMax(id int primary key auto_increment,name varchar(20),subject varchar(2 ...
- 对 Spring IoC 的理解
理解 “ 控制反转(IoC)” 控制反转(IoC):用白话来讲,就是由 Spring 容器控制程序中类与类之间的关系,而非传统实现中,由程序代码直接操控.这也就是所谓 “控制反转” 的概念所在:控制权 ...
- 树莓派 -- i2c学习
硬件平台 RaspberryPi-3B+ Pioneer600外扩版 i2c芯片为DS3231,adddress 0x68 首先来看一下i2ctool的使用 i2ctool 使用 https://i2 ...
- JSONArray 遍历方式
第一种(java8):遍历JSONArray 拼接字符串 public static void main(String[] args) { JSONArray jSONArray = new JSON ...
- 解决Antimalware Service Executable CPU,内存占用高的问题
1.win键+R键打开运行对话框框,输入gpedit.msc打开本地组策略编辑器(组策略):2.依次打开计算机配置-管理模板-Windows组件-Windows Defender:3.如果要关闭Win ...
- Python安装配置
Python下载 官网下载地址:https://www.python.org/downloads/windows/ 下载安装包: python-3.5.0-amd64(64位).exe python- ...
- SPOJ GSS6 Can you answer these queries VI
Can you answer these queries VI Time Limit: 2000ms Memory Limit: 262144KB This problem will be judge ...
- 完美解决了span的宽度设置
下 面代码的CSS定义完美解决了span的宽度设置问题.由于浏览器通常对不支持的CSS属性采取忽略处理的态度,所以最好将display:inline -block行写在后面,这样在Firefox里面, ...
- [cf360 div1.C]The Values You Can Make[Dp]
题意:有n个硬币,面值不同,求能组成K的方案中,每个方案的硬币可以凑成那些答案. 例如, K=5 面值={1,1,1,2,3} K={1,1,1,2} K={1,1,3} K={2,3} 那么答案是 ...
- 【intellij】intellij idea 建立与src级别的目录
在使用三大框架时,通常会把配置文件放在自己新建的config文件夹里,以便编程.在 myeclipse里新建的config文件夹是Source Folder属性的 这样他的级别适合src一个级别,但是 ...