--- title: Advanced field queries slug: '1897' canonical_url: https://docs.coveo.com/en/1897/ collection: searching-with-coveo source_format: adoc --- # Advanced field queries The Coveo [query syntax](https://docs.coveo.com/en/181/) includes special [field](https://docs.coveo.com/en/200/) operators to perform advanced matches. These _advanced field queries_ perform the match directly on field values rather than through the [index](https://docs.coveo.com/en/204/), as is the case for regular [field queries](https://docs.coveo.com/en/1552#field-queries). The benefit of advanced field queries is that you can search field values for occurrences of special characters which are typically not searchable because they're not indexed (for example, dots, dashes, parentheses, etc.), and which can act as [search prefixes or operators](https://docs.coveo.com/en/1814/). You can only use an advanced field query if the queried field is a [facet field](https://docs.coveo.com/en/1833#facet-and-multi-value-facet). > **Note** > > Advanced field query search results will return within 1 second. > However, when the number of items, possible field values, or complexity of the matching expression (for regular expressions) increases, or when field values aren't loaded in cache memory, this will take more time. ## Advanced field query syntax The advanced field query syntax is: `@ ""`. Space characters on either side of the operator are optional. |=== | Advanced field operator | Description | `*=` | [Wildcard match](#wildcard-match) | `~=` | [Fuzzy match](#fuzzy-match) | `%=` | [Phonetic match](#phonetic-match) | `/=` | [Regular expression match](#regular-expression-match) |=== > **Notes** > > * The wildcard, fuzzy, phonetic, and regular expression advanced field queries are case-insensitive and aren't subject to [stemming](https://docs.coveo.com/en/3436/). > > * Wildcard, fuzzy, phonetic, and regular expression advanced field queries can only be made against fields with the [**Facet**](https://docs.coveo.com/en/1833#facet-and-multi-value-facet) option and [**Search operator**](https://docs.coveo.com/en/1833#search-operator-and-displayable-in-results) option enabled. ## Wildcard match Wildcard matches broaden the search results by introducing some variability into the query string. The wildcard match operator (`*=`) interprets any wildcard characters (`?`, `{asterisk}`) which are present in the field value (`""`) without the restrictions that usually apply when you [use wildcard characters in an index query](https://docs.coveo.com/en/1580#wildcard-constraints). You can use one or more wildcard characters anywhere in the field value, and all possible combinations will be matched. **Examples** * With `@author **= "**son"`, matches would include: _E. Johnson_, _ejohnson,_ _catherine_manson,_ etc. * `@filename {asterisk}= "{asterisk}.mp?"` matches any MP3 or MP4 file name. * `@title **= "colo**r"` matches titles that contain either the `color` or the `colour` spelling. ## Fuzzy match Fuzzy matches broaden the search results by allowing for some variance between the query string and the matched results. The fuzzy match operator (`~=`) applies to a minimum of 2 words and searches for matches that vary by up to 20% from the queried value (that is, the matches can be up to 20% longer or shorter, can contain up to 20% different characters, or any combination thereof). **Examples** * `@country ~= "United Sttes"` The correct spelling of `United States` is one character longer than the queried value. The correctly spelled country will be returned as a match because it only varies from the query string by 8% (that is, it's 1 character longer than the 11 characters in the query). * `@country ~= "Untied Stets"` The correct spelling of `United States` is one character longer than and differs by two characters from the queried value. The correctly spelled country won't be returned as a match because it varies from the query string by 23%. ### Using a wildcard in a fuzzy match You can only add a wildcard (`{asterisk}`) to the end of a fuzzy query. If the `{asterisk}` character appears anywhere else, it's not interpreted as a wildcard. **Example** `@author ~= "Dipartiment of*"` The queried value (not including the wildcard character) is 13 characters long, so matches can vary by up to 2 characters. As with any other wildcard match, all possible combinations that match the wildcard will be returned, regardless of length. In this case, for example, `Department of Justice`, `Department of Defense`, and `Department of Education` would all be matching values. ## Phonetic match The phonetic match operator (`%=`) converts the queried value to [phonetic codes](https://en.wikipedia.org/wiki/Phonetic_algorithm), compares these codes to the phonetic codes of all possible field values, and returns those that share some of the same phonetic codes. **Example** Phonetic match can be used to find variants of people's names. `@author %= "Georg"` |=== | Value | Phonetic codes | Matches | `Georg` | `JRK` and `KRK` | `George` and `Jörg` | `George` | `JRJ` and `KRK` | `Georg` | `Jörg` | `JRK` and `ARK` | `Georg` |=== > **Note** > > Phonetic match looks for the phonetic codes for several languages with a limited phonetic code complexity. > Consequently, the matching results may appear incomplete, particularly for long queried values. ## Regular expression match The [regular expression](http://en.wikipedia.org/wiki/Regular_expression) (regex) operator (`/=`) applies the regular expression entered as the field value to match precise content. The regex uses a `match` operation to match the entire content of the field. When writing your regex, use the [ECMAScript syntax](http://www.regular-expressions.info/javascript.html) implemented by JavaScript. **Example** `@username /= "[\w\.%\+]+@[a-zA-Z0-9\.\-]+\.[A-Za-z]{2,4}"` matches user names that are in email form.