Skip to content

Commit b5276bc

Browse files
authored
Merge pull request #110223 from HeidiSteen/heidist-search
[Azure Cognitive Search] wildcard query example update
2 parents d14ce54 + 4432e7b commit b5276bc

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

articles/search/query-lucene-syntax.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,17 @@ The following example helps illustrate the differences. Suppose that there's a s
157157
## <a name="bkmk_regex"></a> Regular expression search
158158
A regular expression search finds a match based on the contents between forward slashes "/", as documented in the [RegExp class](https://lucene.apache.org/core/6_6_1/core/org/apache/lucene/util/automaton/RegExp.html).
159159

160-
For example, to find documents containing "motel" or "hotel", specify `/[mh]otel/`. Regular expression searches are matched against single words.
160+
For example, to find documents containing "motel" or "hotel", specify `/[mh]otel/`. Regular expression searches are matched against single words.
161161

162162
## <a name="bkmk_wildcard"></a> Wildcard search
163-
You can use generally recognized syntax for multiple (*) or single (?) character wildcard searches. Note the Lucene query parser supports the use of these symbols with a single term, and not a phrase.
163+
You can use generally recognized syntax for multiple (*) or single (?) character wildcard searches. Note the Lucene query parser supports the use of these symbols with a single term, and not a phrase.
164164

165-
For example, to find documents containing the words with the prefix "note", such as "notebook" or "notepad", specify "note*".
165+
Prefix search also uses the asterisk (`*`) character. For example, a query expression of `search=note*` returns "notebook" or "notepad". Full Lucene syntax is not required for prefix search. The simple syntax supports this scenario.
166+
167+
Suffix search, where `*` or `?` precedes the string, requires full Lucene syntax and a regular expression (you cannot use a * or ? symbol as the first character of a search). Given the term "alphanumeric", a query expression of (`search=/.*numeric.*/`) will find the match.
166168

167169
> [!NOTE]
168-
> You cannot use a * or ? symbol as the first character of a search.
169-
> No text analysis is performed on wildcard search queries. At query time, wildcard query terms are compared against analyzed terms in the search index and expanded.
170+
> During query parsing, queries that are formulated as prefix, suffix, wildcard, or regular expressions are passed as-is to the query tree, bypassing [lexical analysis](search-lucene-query-architecture.md#stage-2-lexical-analysis). Matches will only be found if the index contains the strings in the format your query specifies. In most cases, you will need an alternative analyzer during indexing that preserves string integrity so that partial term and pattern matching succeeds. For more information, see [Partial term search in Azure Cognitive Search queries](search-query-partial-matching.md).
170171
171172
## See also
172173

articles/search/query-simple-syntax.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ The suffix operator is an asterisk `*`. For example, `cap*` will search for docu
7272

7373
Similar to filters, a prefix query looks for an exact match. As such, there is no relevance scoring (all results receive a search score of 1.0). Prefix queries can be slow, especially if the index is large and the prefix consists of a small number of characters.
7474

75+
If you want to execute a suffix query, matching on the last part of string, use a [wildcard search](query-lucene-syntax.md#bkmk_wildcard) and the full Lucene syntax.
76+
7577
## Phrase search operator
7678

7779
The phrase operator encloses a phrase in quotation marks `" "`. For example, while `Roach Motel` (without quotes) would search for documents containing `Roach` and/or `Motel` anywhere in any order, `"Roach Motel"` (with quotes) will only match documents that contain that whole phrase together and in that order (text analysis still applies).

articles/search/search-query-partial-matching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The solution is to store intact versions of these strings in the index so that y
2323
In Azure Cognitive Search, partial search is available in these forms:
2424

2525
+ [Prefix search](query-simple-syntax.md#prefix-search), such as `search=cap*`, matching on "Cap'n Jack's Waterfront Inn" or "Gacc Capital". You can use the simply query syntax for prefix search.
26-
+ [Wildcard search](query-lucene-syntax.md#bkmk_wildcard) or [Regular expressions](query-lucene-syntax.md#bkmk_regex) that search for a pattern or parts of an embedded string, including the suffix. For example, given the term "alphanumeric", you would use a wildcard search (`search=/.*numeric.*/`) for a suffix query. Wildcard and regular expressions require the full Lucene syntax.
26+
+ [Wildcard search](query-lucene-syntax.md#bkmk_wildcard) or [Regular expressions](query-lucene-syntax.md#bkmk_regex) that search for a pattern or parts of an embedded string, including the suffix. For example, given the term "alphanumeric", you would use a wildcard search (`search=/.*numeric.*/`) for a suffix query match on that term. Wildcard and regular expressions require the full Lucene syntax.
2727

2828
When any of the above query types are needed in your client application, follow the steps in this article to ensure the necessary content exists in your index.
2929

articles/search/search-query-simple-examples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ ms.date: 11/04/2019
1313

1414
# Create a simple query in Azure Cognitive Search
1515

16-
In Azure Cognitive Search, the [simple query syntax](https://docs.microsoft.com/rest/api/searchservice/simple-query-syntax-in-azure-search) invokes the default query parser for executing full text search queries against an index. This parser is fast and handles common scenarios, including full text search, filtered and faceted search, and geo-search.
16+
In Azure Cognitive Search, the [simple query syntax](query-simple-syntax.md) invokes the default query parser for executing full text search queries against an index. This parser is fast and handles common scenarios, including full text search, filtered and faceted search, and geo-search.
1717

1818
In this article, we use examples to illustrate the simple syntax.
1919

20-
An alternative query syntax is [Full Lucene](https://docs.microsoft.com/rest/api/searchservice/lucene-query-syntax-in-azure-search), supporting more complex query structures, such as fuzzy and wildcard search, which can take additional time to process. For more information and examples demonstrating full syntax, see [Use the full Lucene syntax](search-query-lucene-examples.md).
20+
An alternative query syntax is [Full Lucene](query-lucene-syntax.md), supporting more complex query structures, such as fuzzy and wildcard search, which can take additional time to process. For more information and examples demonstrating full syntax, see [Use the full Lucene syntax](search-query-lucene-examples.md).
2121

2222
## Formulate requests in Postman
2323

0 commit comments

Comments
 (0)