Sphinx Full-Text Search engine usage guide: Search

Source: Internet
Author: User
Keywords Using the guide Sphinx full-text search engine
Tags cat default example expression full-text search full-text search engine guide operator

4.1. Matching mode

Like the following optional pattern:

? Sph_match_all, matching all query words (default mode)

? Sph_match_any, matching any one of the query words

? Sph_match_phrase, consider the entire query as a phrase that requires a complete match in order

? Sph_match_boolean, consider a query as a Boolean expression (see section 4.2, "Boolean query Syntax"

? sph_match_extended, consider a query as an expression sphinx the internal query language (see section 4.3, "Extended query Syntax")

There is also a special "full scan" mode, which is automatically activated when the following conditions are met:

The query string is empty (that is, the length is 0) 2. DocInfo storage mode is extern

In full scan mode, all indexed documents are considered to be matched. Such matches are still filtered, sorted, or grouped, but do not do any real full-text searches. This pattern can be used to unify full-text and non full-text search code, or to reduce the burden on SQL Servers (sometimes Sphinx scans are faster than similar MySQL queries)

4.2. Boolean Query

Boolean queries allow the following special operators to be used:? Explicit and operator

Hello & World

? or (or) operator

Hello | World

? non (not) operator

Hello-world Hello!world

? grouping (grouping)

(Hello World)

Here is an example that uses all of the above operators:

Example 5 Boolean Query example

(Cat-dog) | (Cat-mouse)

And operator is the default action, so "Hello World" is actually "Hello & World"

or (or) operator has precedence over the operator, so "Lookingfor cat | Dog | Mouse "means" looking for (cat | dog | mouse) instead of (looking for cat) | Dog | Mouse"

A query like "-dog" cannot be executed because it almost includes indexing all documents. This has both technical and performance reasons. Technically speaking, Sphinx does not always keep a list of all document IDs. Performance, it can take a long time to execute a query when the document set is very large (that is, 10-100m documents).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.