Home Database Mysql Tutorial [教程]MongoDB 从入门到进阶 (TextSearch)

[教程]MongoDB 从入门到进阶 (TextSearch)

Jun 07, 2016 pm 05:54 PM
mongodb getting Started Tutorial Advanced

随着MongoDB 2.4.1的发布(由于2.4.0刚发布就发现一个重大的Bug,所以现在的最新版本是2.4.1),全文检索的功能也被追加进MongoDB了。不过全文检索功能现在仅仅能够用于对于拉丁文的检索。 1.首先要使用MongoDB2.4.1,请先到官网下载最新版的MongoDB 2.如果

随着MongoDB 2.4.1的发布(由于2.4.0刚发布就发现一个重大的Bug,所以现在的最新版本是2.4.1),全文检索的功能也被追加进MongoDB了。不过全文检索功能现在仅仅能够用于对于拉丁文的检索。

1.首先要使用MongoDB2.4.1,美国空间,请先到官网下载最新版的MongoDB 

2.如果你以前已经配置过MongoDB了,这次为了启用TextSearch,请务必打开TextSearch功能:

在原来的配置文件中增加  --setParameter textSearchEnabled=true

例子:

cd C:\runmongo\bin
mkdir C:\mongodb\SinaWeibo
mongod --port  28030 --dbpath C:\mongodb\SinaWeibo --rest --setParameter textSearchEnabled=true
这样的话,你就开启了全文检索功能,但是这个功能不要轻易在生产环境中使用,这个会降低服务器的效率,消耗大量的内存。

3.我的工具在第一时间开始支持TextSearchIndex的建立功能。

不知道为什么,香港虚拟主机,现在这个Index的类型很奇怪,不是text而是如下所示的样子

接下来我们试试看TextSearch。

这里使用了微博的数据。微博里面有【good】这样的表情,我们就看看有多少包含good的微博吧。

上面我们已经对微博内容进行了全文索引的建立

这里从结果可以看到一共有44件搜索结果

工具最新版本可以在这里下载  

所有的源代码可以在github上找到:

https://github.com/magicdict/MagicMongoDBTool

这个版本的工具还有很多问题,没有完全修正1.80驱动的变更点,所以只能作为学习和测试之用。

现在正在搞微信的开发,大家帮忙加一下微信公众账号,谢谢了。

任何关于MongoDB 2.4.1和C#的问题,请联系我。

再次感谢您对于这个工具的支持特别是前一段时间的两位朋友,给了我很多意见和建议,香港虚拟主机,谢谢大家。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Advanced Bootstrap Tutorial: Mastering Customization & Components Advanced Bootstrap Tutorial: Mastering Customization & Components Apr 04, 2025 am 12:04 AM

How to master Bootstrap customization and component usage includes: 1. Use CSS variables and Sass preprocessor for style customization; 2. Deeply understand and modify component structure and behavior. Through these methods, a unique user interface can be created to improve the responsiveness and user experience of the website.

How to configure MongoDB automatic expansion on Debian How to configure MongoDB automatic expansion on Debian Apr 02, 2025 am 07:36 AM

This article introduces how to configure MongoDB on Debian system to achieve automatic expansion. The main steps include setting up the MongoDB replica set and disk space monitoring. 1. MongoDB installation First, make sure that MongoDB is installed on the Debian system. Install using the following command: sudoaptupdatesudoaptinstall-ymongodb-org 2. Configuring MongoDB replica set MongoDB replica set ensures high availability and data redundancy, which is the basis for achieving automatic capacity expansion. Start MongoDB service: sudosystemctlstartmongodsudosys

Use Composer to solve the dilemma of recommendation systems: andres-montanez/recommendations-bundle Use Composer to solve the dilemma of recommendation systems: andres-montanez/recommendations-bundle Apr 18, 2025 am 11:48 AM

When developing an e-commerce website, I encountered a difficult problem: how to provide users with personalized product recommendations. Initially, I tried some simple recommendation algorithms, but the results were not ideal, and user satisfaction was also affected. In order to improve the accuracy and efficiency of the recommendation system, I decided to adopt a more professional solution. Finally, I installed andres-montanez/recommendations-bundle through Composer, which not only solved my problem, but also greatly improved the performance of the recommendation system. You can learn composer through the following address:

How to transfer coins to Binance? How to mention the crypto assets in HTX to the Binance platform? How to transfer coins to Binance? How to mention the crypto assets in HTX to the Binance platform? Mar 03, 2025 pm 08:51 PM

Huobi to Binance Transfer Guide: Safe and conveniently transfer your crypto assets Many investors use Huobi and Binance at the same time. This article will guide you how to safely transfer crypto assets on Huobi (HTX), such as TRUMP and USDT, to the Binance platform. Binance is popular for its high security, rich currency and trading pairs, and world-leading trading volume. Binance Exchange’s advantages: the world’s number one trading volume, accounting for 50% of the global market; transparent reserve assets are mainly mainstream stablecoins such as Bitcoin, Ethereum and USDT; it has effectively avoided the potential risks of the US SEC and is one of the most stable and reliable exchanges at present. This tutorial will take TRUMP and USDT as examples

How to ensure high availability of MongoDB on Debian How to ensure high availability of MongoDB on Debian Apr 02, 2025 am 07:21 AM

This article describes how to build a highly available MongoDB database on a Debian system. We will explore multiple ways to ensure data security and services continue to operate. Key strategy: ReplicaSet: ReplicaSet: Use replicasets to achieve data redundancy and automatic failover. When a master node fails, the replica set will automatically elect a new master node to ensure the continuous availability of the service. Data backup and recovery: Regularly use the mongodump command to backup the database and formulate effective recovery strategies to deal with the risk of data loss. Monitoring and Alarms: Deploy monitoring tools (such as Prometheus, Grafana) to monitor the running status of MongoDB in real time, and

Navicat's method to view MongoDB database password Navicat's method to view MongoDB database password Apr 08, 2025 pm 09:39 PM

It is impossible to view MongoDB password directly through Navicat because it is stored as hash values. How to retrieve lost passwords: 1. Reset passwords; 2. Check configuration files (may contain hash values); 3. Check codes (may hardcode passwords).

What is Binance C2C? What are the risks? Is it safe? Binance C2C Coins Buying and Selling Coins Tutorial What is Binance C2C? What are the risks? Is it safe? Binance C2C Coins Buying and Selling Coins Tutorial Mar 05, 2025 pm 04:48 PM

Binance C2C Trading Guide: Safe and convenient way to deposit and withdraw money in cryptocurrency. This article will explain the Binance C2C (CustomertoCustomer) trading model in detail, explain its security, characteristics and operation procedures, and provide graphic tutorials to help you easily master the Binance C2C deposit and withdraw money in ease. What is Binance C2C? Binance C2C is a user-to-user cryptocurrency trading service provided by the Binance platform, providing users with convenient cryptocurrency and fiat currency exchange channels. Launched in 2019, the service supports multiple cryptocurrencies and fiat currency transactions through a peer-to-peer trading model, and provides enhanced security and multiple features. Compared with traditional OTC trading, Binance C2C platform authenticates both parties to the transaction and provides complete support.

What is the CentOS MongoDB backup strategy? What is the CentOS MongoDB backup strategy? Apr 14, 2025 pm 04:51 PM

Detailed explanation of MongoDB efficient backup strategy under CentOS system This article will introduce in detail the various strategies for implementing MongoDB backup on CentOS system to ensure data security and business continuity. We will cover manual backups, timed backups, automated script backups, and backup methods in Docker container environments, and provide best practices for backup file management. Manual backup: Use the mongodump command to perform manual full backup, for example: mongodump-hlocalhost:27017-u username-p password-d database name-o/backup directory This command will export the data and metadata of the specified database to the specified backup directory.

See all articles