You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Managed query is a search operation that delegates to the underlying field types to determine how the field should
@@ -31,110 +31,222 @@ be searched. In most cases the field value type will be 'Full Text', others may
31
31
## Per field
32
32
33
33
```csharp
34
-
varsearcher=myIndex.GetSearcher(); // Get a searcher
34
+
varsearcher=myIndex.Searcher; // Get a searcher
35
35
varresults=searcher.CreateQuery() // Create a query
36
36
.Field("Address", "Hills") // Look for any "Hills" addresses
37
37
.Execute(); // Execute the search
38
38
```
39
39
40
+
### Terms and Phrases
41
+
42
+
When searching on fields like in the example above you might want to search on more than one word/term. In Examine this can be done by simply adding more terms to the field filter.
43
+
44
+
```csharp
45
+
varsearcher=myIndex.Searcher;
46
+
varresults=searcher.CreateQuery()
47
+
// Look for any addresses that has "Hills" or "Rockyroad" or "Hollywood"
48
+
.Field("Address", "Hills Rockyroad Hollywood")
49
+
.Execute();
50
+
```
51
+
52
+
The way that terms are split depends on the Analyzer being used. The StandardAnalyzer is the default. An example of how Analyzers work are:
53
+
54
+
- StandardAnalyzer - will split a string based on whitespace and 'stop words' (i.e. common words that are not normally searched on like "and")
55
+
- WhitespaceAnalyzer - will split a string based only on whitespace
56
+
- KeywordAnalyzer - will not split a string and will treat the single string as one term - this means that searching will be done on an exact match
57
+
58
+
There are many [Analyzers](https://lucenenet.apache.org/docs/4.8.0-beta00016/api/core/Lucene.Net.Analysis.html) and you can even create your own. See more about analyzers in [configuration](./configuration.md#example---phone-number).
59
+
60
+
Looking at this example when using the default StandardAnalyser the code above means that the `Address` in this example has to match any the values set in the statement. This is because Examine will create a Lucene query like this one where every word is matched separately: `Address:hills Address:rockyroad Address:hollywood`.
61
+
62
+
Instead, if you want to search for entries with the values above in that exact order you specified you will need to use the `.Escape()` method. See under [Escape](#escape).
63
+
64
+
```csharp
65
+
varsearcher=myIndex.Searcher;
66
+
varresults=searcher.CreateQuery()
67
+
// Look for any addresses with the exact phrase "Hills Rockyroad Hollywood"
This creates a query like this instead: `Address:"Hills Rockyroad Hollywood"`. This means that you're now searching for the exact phrase instead of entries where terms appear.
73
+
40
74
## Range queries
41
75
76
+
Range Queries allow one to match documents whose field(s) values are between the lower and upper bound specified by the Range Query
This will return results where the field `SomeFloat` is within the range 0 - 100 (min value and max value included).
90
+
50
91
### Date Range
51
92
93
+
Example:
94
+
52
95
```csharp
53
-
varsearcher=indexer.GetSearcher();
96
+
varsearcher=indexer.Searcher;
54
97
55
-
varnumberSortedCriteria=searcher.CreateQuery()
98
+
varquery=searcher.CreateQuery()
56
99
.RangeQuery<DateTime>(
57
-
new[] { "created" },
58
-
newDateTime(2000, 01, 02),
59
-
newDateTime(2000, 01, 05),
100
+
new[] { "created" },
101
+
newDateTime(2000, 01, 02),
102
+
newDateTime(2000, 01, 05),
103
+
minInclusive: true,
60
104
maxInclusive: false);
105
+
106
+
varresults=query.Execute();
61
107
```
62
108
109
+
This will return results where the field `created` is within the date 2000/01/02 and 2000/01/05 (min value included and max value excluded).
110
+
63
111
## Booleans, Groups & Sub Groups
64
112
65
113
_TODO: Fill this in..._
66
114
67
-
## Lucene queries
115
+
## Boosting
68
116
69
-
### Native Query
117
+
Boosting is the practice of making some parts of your query more relevant than others. This means that you can have terms that will make entries matching that term score higher in the search results.
Fuzzy searching is the practice of finding spellings that are similar to each other. Examine searches based on the [Damerau-Levenshtein Distance](https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance). The parameter given in the `.Fuzzy()` method is the edit distance allowed by default this value is `0.5` if not specified.
92
147
93
-
## Boosting, Proximity, Fuzzy & Escape
148
+
The value on `.Fuzzy()` can be between 0 and 2. Any number higher than 2 will be lowered to 2 when creating the query.
This will match for example: `test`, `tests` and `tester`
217
+
218
+
## Lucene queries
219
+
220
+
Find a reference to how to write Lucene queries in the [Lucene 4.8.0 docs](https://lucene.apache.org/core/4_8_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description).
0 commit comments