diff --git a/mkdocs.yml b/mkdocs.yml index 484781a3762..c52fdab0f9f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -159,6 +159,7 @@ nav: - Using NPM aliases: guides/assets-manager/NPM_ALIASING_GUIDE.md - Gulp pipeline: guides/gulp-pipeline/README.md - Creating a Custom Module: guides/create-install-custom-module/README.md + - Lucene Query Syntax: guides/lucene-query-syntax/README.md - Key Topics: - Manage your Content: topics/content-management/README.md - Content Relationships: topics/content-relationships/README.md diff --git a/src/docs/guides/lucene-query-syntax/README.md b/src/docs/guides/lucene-query-syntax/README.md new file mode 100644 index 00000000000..ab82a7ea0da --- /dev/null +++ b/src/docs/guides/lucene-query-syntax/README.md @@ -0,0 +1,118 @@ +# Lucene Query Syntax +The search form in Orchard Core uses Lucene's query syntax, which allows you to search for specific terms, perform wildcard searches, approximate searches, proximity searches, range searches, and combine conditions using Boolean operators. + +## Boolean Operators +Boolean operators allow you to combine query terms using logical operators. These Boolean operators are compatible. + + +### AND +The *AND* operator can be used to find terms anywhere in the text. + +To search for documents containing both "lorem" and "man", use the following query: + +`lorem and man` + +![AND operator](images/operator-and.PNG) + + +### + +The *+* operator requires that the term following the "+" symbol exists somewhere in a single document's field. To search for documents that must contain "Man" and may contain "explore", use the following query: + +`+Man explore` + +![required operator](images/required-operator.PNG) + + +### NOT +The *NOT* operator is used to exclude documents that contain the term after the word NOT. You can use the symbol ! or the symbol "-" instead of the word NOT. + +To find documents that contain "Lucene" but not "Lorem", use the following query: +`Lucene NOT Lorem` + +![NOT operator](images/operator-not.PNG) + + +### - +The *-* or prohibition operator excludes documents containing the term that appears after the hyphen. + +To search for documents containing "Lucene" but not "Lorem", use the following query: + +`Lucene-Lorem` + +![prohibition operator](images/prohibition-operator.PNG) + + +## MATCH ALL +The expression * *:* * is a search query that returns all documents in the index. + +`*:*` + +![match-all-1](images/match-all-1.PNG) + + +![match-all-2](images/match-all-2.PNG) + + +![match-all-3](images/match-all-3.PNG) + + +## Fuzzy Searches +The *~* operator performs a fuzzy search that matches similar terms, including misspelled words. + +To search for terms that match the word "Lucen", use the approximate search: + +`Lucen~` + + +![fuzzy search](images/fuzzy-search.PNG) + + +## Text field +Lucene supports field searches. You can specify a field or use the default field. Field names are text-based, for example: Title, Subtitle. + +To search, type the field name (e.g., Subtitle) followed by a colon ":". + +`Subtitle:What is Lorem Ipsum?` + + +![text field searche](images/text-field.PNG) + + +## Wildcard Searches +It allows you to search for terms using patterns or wildcard characters (*, ?) in any position. + +- The symbol `*` performs a search that represents multiple characters. + +- The symbol `?` performs a search that represents only a single character. + +The single-character wildcard search "?" looks for terms that match the length and the substituted character: +`lu?ene` + +![one character](images/one-character-wildcard.PNG) + +The multi-character wildcard search "*" looks for terms that match any character: +`Lucene*` + +![multiple characters](images/multi-character-wildcard.PNG) + + +## Range Searches +They allow you to search for documents within a range of field values ​​that fall between the lower and upper limits specified by the query. + +The search will find documents whose titles are greater than "A" and less than "P": + +`A TO P` + +![range searches](images/range-searches.PNG) + + +## Regular expressions +They allow you to search for documents using regular expressions, enclosed within forward slashes (/regex/). The pattern must match the entire term, not just a substring within it, unless specified with wildcards. + +The search will find terms that begin with "type" and end with "ing" or "services", ignoring anything in between. + +`/type.*ing?/` + +![regular expressions](images/regular-expresions.PNG) + + diff --git a/src/docs/guides/lucene-query-syntax/images/fuzzy-search.PNG b/src/docs/guides/lucene-query-syntax/images/fuzzy-search.PNG new file mode 100644 index 00000000000..6c2619b2534 Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/fuzzy-search.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/match-all-1.PNG b/src/docs/guides/lucene-query-syntax/images/match-all-1.PNG new file mode 100644 index 00000000000..2fed1045499 Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/match-all-1.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/match-all-2.PNG b/src/docs/guides/lucene-query-syntax/images/match-all-2.PNG new file mode 100644 index 00000000000..fc787826a81 Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/match-all-2.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/match-all-3.PNG b/src/docs/guides/lucene-query-syntax/images/match-all-3.PNG new file mode 100644 index 00000000000..956c2fa0cea Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/match-all-3.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/multi-character-wildcard.PNG b/src/docs/guides/lucene-query-syntax/images/multi-character-wildcard.PNG new file mode 100644 index 00000000000..d8b02681aa4 Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/multi-character-wildcard.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/one-character-wildcard.PNG b/src/docs/guides/lucene-query-syntax/images/one-character-wildcard.PNG new file mode 100644 index 00000000000..313c05f82ab Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/one-character-wildcard.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/operator-and.PNG b/src/docs/guides/lucene-query-syntax/images/operator-and.PNG new file mode 100644 index 00000000000..f65ddd4074c Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/operator-and.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/operator-not.PNG b/src/docs/guides/lucene-query-syntax/images/operator-not.PNG new file mode 100644 index 00000000000..cc010510643 Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/operator-not.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/prohibition-operator.PNG b/src/docs/guides/lucene-query-syntax/images/prohibition-operator.PNG new file mode 100644 index 00000000000..bd3422e9e07 Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/prohibition-operator.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/range-searches.PNG b/src/docs/guides/lucene-query-syntax/images/range-searches.PNG new file mode 100644 index 00000000000..a43b9346a58 Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/range-searches.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/regular-expresions.PNG b/src/docs/guides/lucene-query-syntax/images/regular-expresions.PNG new file mode 100644 index 00000000000..afb511b9c17 Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/regular-expresions.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/required-operator.PNG b/src/docs/guides/lucene-query-syntax/images/required-operator.PNG new file mode 100644 index 00000000000..3745956a54d Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/required-operator.PNG differ diff --git a/src/docs/guides/lucene-query-syntax/images/text-field.PNG b/src/docs/guides/lucene-query-syntax/images/text-field.PNG new file mode 100644 index 00000000000..fc36f38bf1b Binary files /dev/null and b/src/docs/guides/lucene-query-syntax/images/text-field.PNG differ