--- title: Search prefixes and operators slug: '1814' canonical_url: https://docs.coveo.com/en/1814/ collection: searching-with-coveo source_format: adoc --- # Search prefixes and operators You can use search prefixes and operators to refine a search by specifying more precisely what terms (words, numbers, expressions, etc.) you're looking for. The following sections describe the syntax of prefixes and operators that you can use when you build a search [query](https://docs.coveo.com/en/231/). > **Note** > > Coveo doesn't [index](https://docs.coveo.com/en/204/) special characters other than letters and numbers. > This means that you can't search for a special character or for an [expression containing a special character](https://docs.coveo.com/en/2744/) such as an email address that contains the `@` character. > You can however use them to make [advanced field queries](https://docs.coveo.com/en/1897/). > > If you have querying issues, see the [troubleshooting guidelines](https://docs.coveo.com/en/1870/). ## Exact match operators Exact match operators allow you to search for a [specific term](https://docs.coveo.com/en/1815/) or [phrase](https://docs.coveo.com/en/1686/). ## Boolean operators The following Boolean operators act on string content. You can enable them by setting the [`enableQuerySyntax`](https://coveo.github.io/search-ui/components/resultspreferences.html#options.enablequerysyntax) query parameter to `true`. ### `AND` The [item](https://docs.coveo.com/en/210/) must contain all terms (words, numbers, etc.) joined by `AND`. The term order is irrelevant. > **Note** > > By default, the `AND` operator is implicitly assumed between many terms separated by a space. For example, `Coveo AND Search AND Help` returns items containing all three terms and is equivalent to `Coveo Search Help`. ### `OR` The item must contain at least one of the terms (words, numbers, etc.) joined by `OR`. For example, `Coveo OR Search` returns items containing _Coveo_ or _Search,_ or both. Alternatively, you can use comma-separated terms between [parentheses](#miscellaneous-operators) to achieve the same result. ### `NOT` The item must not contain the term (words, numbers, etc.) preceded by `NOT`. For example, `report NOT technical` returns items that don't contain _technical_ but do contain _report._ The [`-` prefix](#miscellaneous-operators) has the same effect. ### `NEAR` The item must contain the two terms (words, numbers, etc.) joined by the `NEAR` operator, and there shouldn't be more than a certain number of terms between these terms in the item. This operator is useful to eliminate items containing scattered occurrences of two queried terms when you rather search for items containing the two terms close to each other. You can specify the maximum number of terms to allow between your two terms using the `NEAR:n` operator format. If you use `NEAR` only, that is, you don't specify a value for _n_, the default value is 10. For example, `Coveo NEAR:5 Search` returns items in which _Coveo_ and _Search_ are no more than five terms apart. `Coveo NEAR Search` returns items in which _Coveo_ and _Search_ are no more than ten terms apart. > **Notes** > > * Boolean operators are always recognized as operators when they're typed in uppercase letters. > > * Boolean operators are interpreted as operators regardless of their casing when entered in the search box. > > * The synonym thesaurus rule is supported with the `NEAR` operator, but other thesaurus rule types are not. > For example, when the word `phone` is set as a synonym of `smartphone` in the thesaurus, a query for `phone NEAR sales` becomes `smartphone NEAR sales`. > > * `NEAR:value` isn't interpreted as a [field](https://docs.coveo.com/en/200/) expression, meaning that searching for `near: new york` returns results containing _near,_ _new,_ and _york._ ### Priority of Boolean operators When you use more than one Boolean operator in a query without parenthesis, the query is interpreted with the following Boolean operator priority: . `NEAR` . `NOT` . The implicit `AND` when no operator is entered between two keywords . `OR` For example, you want to find a specific report for the tablet and phone sales outside the USA. You know the desired item contains the words `tablet`, `phone`, or `smartphone` within a few words from the word `sales`. So, to narrow down the results, you type the following query: `tablet AND phone OR smartphone NEAR sales NOT USA`. Because of the Boolean operator priority rule, the query is interpreted as `(tablet AND phone) OR \((smartphone NEAR sales) (NOT USA))`. > **Leading practice** > > Use parenthesis because it's a more explicit method to compose a query with many Boolean operators that translate to the expected behavior. > > However, parenthesis expressions aren't supported immediately before or after the `NEAR` operator. > For example, `(phone OR smartphone) NEAR sales` is an invalid syntax, while `(phone OR smartphone) AND phone NEAR sales` is valid. ## Date/time operators The following date operators act on date and time values. You specify a duration value using the time units suffixes: seconds (`s`), minutes (`m`), hours (`h`), days (`d`), months (`mo`) or years (`y`). ### `now` The item must have been created or modified between now and a required duration value. For example, `+@date<=now-12h+` returns items created or modified at least 12 hours ago. ### `today` The item must have been created or modified today or between today and an optional duration number of days. For example, `@date=today` returns items created or modified today. `@date>=today-30d` returns items created or modified within the last month. ### `yesterday` The item must have been created or modified yesterday or between yesterday and an optional number of days. For example, `@date=yesterday` returns items created or modified yesterday. `@date>yesterday-6d` returns items created or modified in the previous seven days. ## Comparison operators Some [special characters](https://docs.coveo.com/en/2744#equal-character) can be used as comparison operators to search the content of specific [fields](https://docs.coveo.com/en/1833/). ### `=` (contains) The field must contain the terms (words, numbers, etc.) following `=`. When several terms follow `=`, they don't need to be found contiguous or in the exact order, in the item. Applies to string, numeric and date content. For example, `@title=Coveo` returns items containing _Coveo_ in their titles. > **Leading practice** > > To increase query performance, the `=` operator should only be used when the field you're querying against does _not_ have the [**Facet** option*](https://docs.coveo.com/en/1833#facet-and-multi-value-facet) enabled. > See [Improve search response time: comparison operators](https://docs.coveo.com/en/1948#comparison-operators) for other tips. ### `==` (is exactly) The field must contain the exact terms (words, numbers, etc.) as they appear following `==`, in the exact and contiguous order. No other term can be present in the field. Applies to string, numeric and date content. For example, `@filetype=="Coveo Enterprise Search"` returns items with this exact title only: _Coveo Enterprise Search_. > **Leading practice** > > To increase query performance, the `==` operator should only be used when the field you're querying against _does_ have the [**Facet** option* enabled](https://docs.coveo.com/en/1833#facet-and-multi-value-facet). > See [Improve search response time: comparison operators](https://docs.coveo.com/en/1948#comparison-operators) for other tips. ### `<>` (excludes) The field must be defined in the item, and must not contain the terms following the `<>` operator. Applies to string, numeric and date content. For example, `@title <> "Enterprise Search"` returns items that have the `title` field defined and don't contain _Enterprise Search_ in their title. ### `<` (smaller than) The value contained in the field must be inferior to the value entered after `<`. For dates, this means older than, or before. A file size is entered in bytes. Applies to numeric and date content. For example, `@size<50` returns items of 49 bytes or less. `@date` (greater than) The value contained in the field must be superior to the value entered after `>`. For dates, this means more recent than, or after. File size is entered in bytes. Applies to numeric and date content. For example, `@size>50` returns items of 51 bytes or more. `@date>yesterday` returns items created or modified today. ### `+<=+` (smaller than or equal to) The value contained in the field must be inferior or equal to the value entered after `+<=+`. For dates, this means up to the time of reference. File size is entered in bytes. Applies to numeric and date content. For example, `+@size<=50+` returns items of 50 bytes or less. `+@date<=yesterday+` returns items created or modified before today. ### `>=` (greater than or equal to) The value contained in the field must be superior or equal to the value entered after `>=`. For dates, this means at the time of reference and after. File size is entered in bytes. Applies to numeric and date content. For example, `@size>=50` returns items of 50 bytes or more. `@date>=yesterday` returns items modified or created yesterday or today. ## Mathematical operators Some [special characters](https://docs.coveo.com/en/2744/) can be used for queries requiring a mathematical operation. ### `..` (value range) The value contained in the field must be in the inclusive range specified by two values separated by two dots (double points or periods). File size is entered in bytes. Applies to numeric and date content. For example, `@size=1024..2048` returns items of at least 1024 bytes and not more than 2048 bytes in size. > **Note** > > [[multipleranges]]You can specify a list of numeric ranges using the following format: `@numericfield=(a..b,c..d,e..f)`. > > For example, you want to look for items that were created during January of year 2014, 2013, and 2012. > You can use the following multiple-range field query: `@date=(2015/01/01..2015/01/31,2016/01/01..2016/01/31,2017/01/01..2017/01/31)`. ### `+` (plus) The duration value in seconds (`s`), minutes (`m`), hours (`h`), days (`d`), months (`mo`) or years (`y`), is added to the date operator (`now`, `today`, or `yesterday`). For example, `@date **Notes** > > * Query extensions and QPL objects are typically used by advanced administrators and developers. > > * If the character string following the dollar sign isn't a valid query extension name or a valid QPL object name, the query returns the following error message: "Something went wrong. > If the problem persists contact the administrator." ### `( )` (parentheses grouping with operators) The item must contain the keywords and respect the filter built using parentheses to group keywords with operators. Parenthesis are useful to ensure that the desired results when using many Boolean operators in a query. See [Priority of Boolean operators](#priority-of-boolean-operators) and [Using special characters in queries](https://docs.coveo.com/en/2744#parentheses) for more information. For example, `Liz (project NEAR:5 presentation)` returns items containing the three keywords but where keywords _project_ and _presentation_ are no more than five terms apart.