How it works
When you wrap part or all of a search query in double quotes, Meilisearch treats the quoted portion as a phrase. Instead of matching individual words independently, the engine looks for documents where those words appear consecutively and in the specified order. A query like"african american" horror contains one phrase (african american) and one regular term (horror). Meilisearch finds documents where “african” and “american” appear next to each other, and also contain “horror”.
Example response
Given amovies index, searching for "african american" horror might return:
Phrase search and matching strategy
Phrase search interacts with the matching strategy parameter. The quoted phrase is always treated as a single required unit. When combined with non-quoted terms, the matching strategy applies to those additional terms. For example, with the query"science fiction" adventure comedy:
laststrategy (default): Documents must contain the phrase “science fiction”. The terms “adventure” and “comedy” follow normal matching behavior, where the least important terms may be dropped.allstrategy: Documents must contain the phrase “science fiction” and both additional terms “adventure” and “comedy”.
Multiple phrases in a single query
You can include more than one quoted phrase in a query:When to use phrase search
- Known titles or names: Search for
"The Lord of the Rings"to avoid matching documents that simply contain “lord”, “rings”, or “the” in different contexts - Technical terms: Search for
"machine learning"to find the exact concept rather than separate occurrences of “machine” and “learning” - Quoted expressions: Search for
"to be or not to be"to find the exact phrase
For a complete list of search parameters, see the search API reference.