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
Update docs for v4.0.0 and fix the DocFX publishing pipeline (#588)
The docs site has not deployed since 2023-03-08 and the content on `dev`
had drifted from the v4 API.
Publishing pipeline:
- Trigger `docfx-gh-pages.yml` on push/PR to `dev` (scoped to `docs/**`,
`src/**` and the workflow file) instead of `feature/docfx`, which never
fired. Keep `workflow_dispatch`.
- Install the .NET 8/9/10 SDKs. The DocFX `metadata` step MSBuild-loads
`src/**.csproj`, which now multi-targets net8.0;net9.0;net10.0, so the
pinned .NET 6 SDK could not restore or build it.
- Replace `nunit/docfx-action@v2.10.0` with `dotnet tool install -g docfx`
so the `modern` template builds against a current DocFX.
- Bump `actions/checkout` v3 -> v7, `actions/setup-dotnet` v3 -> v6,
`actions/configure-pages` v3 -> v6, `actions/upload-pages-artifact`
v1 -> v5 and `actions/deploy-pages` v1 -> v5. The v1 Pages actions are
retired.
- Guard the `deploy` job so pull requests build but do not publish.
- Point `_gitContribute.branch` at `dev` so "Edit this page" links resolve,
and exclude `Examine.Benchmarks` from API reference generation.
Content:
- index.md: correct the Minimum Requirements table (V4 is .NET 8.0/9.0/10.0,
V3 is .NET 6.0/8.0 - it was claiming .NET Standard 2.0), correct the
install version to 4.0.0, and add a "What's new in V4" section linking to
the v3-to-v4 API change report and the release notes.
- configuration.md: rewrite the facet and taxonomy registration samples.
They used `facetsConfig:` and `useTaxonomyIndex:` named parameters on
`AddExamineLuceneIndex` that do not exist; these are properties on
`LuceneIndexOptions`. Replace the v3-era "After construction" section,
which used a removed `LuceneIndex` constructor and a
`FieldDefinitionCollection` that is no longer publicly mutable. Note that
`UseTaxonomyIndex` defaults to true. Document the NRT options,
`IndexDeletionPolicy`, `UnlockIndex` and `DirectoryFactory`.
- searching.md: rewrite the Faceting section - every sample called
`facets.Facet(...)`, which does not exist; the API is `FacetString`,
`FacetLongRange`, `FacetDoubleRange` and `FacetFloatRange`. Cover
`GetFacets()`, `TryGetFacet` and nullable results, and taxonomy-side
faceting. Fill in the "Booleans, Groups & Sub Groups" section, which was
a TODO. Document `SelectField`/`SelectFields`/`SelectAllFields`,
`WithBoost` and `Phrase()`.
- paging.md: document deep paging with `SearchAfterOptions` and
`ExecuteWithLucene`, plus skip/take limits, scoring options and facet
sampling. Correct `DefaultMaxResults` from 500 to 100.
- Replace `indexer.GetSearcher()` with the `Searcher` property throughout.
- Fix several samples that assigned `CreateQuery()` to a variable and then
called `Or()`, `And()` or `Execute()` on it. `IQuery` exposes none of
those - they are on `IBooleanOperation`, so the samples did not compile.
- Add replication.md covering `ExamineReplicator`, taxonomy replication,
scheduled replication and `IsReplicationHealthy`. Replication had no
documentation.
- developerguides: correct the project paths in codestructure.md, add
`Examine.Benchmarks`, note the .NET 10 SDK requirement in buildtest.md,
clean up the DocFX build instructions in docsite.md and add the 4.0.0 GA
entry to roadmap.md.
- Sweep stale links: Lucene.NET `4.8.0-beta00016` -> `4.8.0-beta00018`
(the dependency did not change in v4, the docs were just wrong), and
`blob/master` / `blob/release/3.0` source links -> `blob/dev`.
Every code sample was compiled against the v4 assemblies to verify it uses
real APIs. `docs/docs-v1-v2/` is intentionally left untouched.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/articles/configuration.md
+68-68Lines changed: 68 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,8 +25,8 @@ Configuration of Examine indexes is done with [.NET's Options pattern](https://d
25
25
There are several options that can be configured, the most common ones are:
26
26
27
27
*__FieldDefinitions___[`FieldDefinitionCollection`](xref:Examine.FieldDefinitionCollection)_ - Manages the mappings between a field name and it's index value type
28
-
*__Analyzer___`Analyzer`_ - The default Lucene Analyzer to use for each field (default = [`StandardAnalyzer`](https://lucenenet.apache.org/docs/4.8.0-beta00016/api/analysis-common/Lucene.Net.Analysis.Standard.StandardAnalyzer.html))
29
-
*__Validator___[`IValueSetValidator`]([`IValueSetValidator`](xref:Examine.IValueSetValidator))_ - Used to validate a value set to be indexed, if validation fails it will not be indexed
28
+
*__Analyzer___`Analyzer`_ - The default Lucene Analyzer to use for each field (default = [`StandardAnalyzer`](https://lucenenet.apache.org/docs/4.8.0-beta00018/api/analysis-common/Lucene.Net.Analysis.Standard.StandardAnalyzer.html))
29
+
*__Validator___[`IValueSetValidator`](xref:Examine.IValueSetValidator)_ - Used to validate a value set to be indexed, if validation fails it will not be indexed
30
30
*__[IndexValueTypesFactory](xref:Examine.Lucene.IFieldValueTypeFactory)___`IReadOnlyDictionary<string, IFieldValueTypeFactory>`_ - Allows you to define custom Value Types
31
31
32
32
```cs
@@ -35,7 +35,7 @@ There are several options that can be configured, the most common ones are:
@@ -52,39 +52,22 @@ public sealed class ConfigureIndexOptions : IConfigureNamedOptions<LuceneDirecto
52
52
}
53
53
```
54
54
55
-
### After construction
55
+
### At registration
56
56
57
-
You can modify the field definitions [FieldDefinitionCollection](xref:Examine.FieldDefinitionCollection) for an index after it is constructed by using any of the following methods:
58
-
59
-
*`myIndex.FieldDefinitionCollection.TryAdd`
60
-
*`myIndex.FieldDefinitionCollection.AddOrUpdate`
61
-
*`myIndex.FieldDefinitionCollection.GetOrAdd`
62
-
63
-
These modifications __must__ be done before any indexing or searching is executed.
64
-
65
-
### Add a field value type after construction
66
-
67
-
It is possible to add custom field value types after the construction of the index, but this must be done before the index is used. Some people may prefer this method of adding custom field value types. Generally, these should be modified directly after the construction of the index.
57
+
The same options can be set inline when the index is registered, without a separate
An index's field definitions are fixed once the index is in use. [`IIndex.FieldDefinitions`](xref:Examine.IIndex#Examine_IIndex_FieldDefinitions) exposes them as a [`ReadOnlyFieldDefinitionCollection`](xref:Examine.ReadOnlyFieldDefinitionCollection) for inspection only - all configuration __must__ be done through the options above, before any indexing or searching is executed.
70
+
88
71
## Value types
89
72
90
73
Value types are responsible for:
@@ -163,7 +146,7 @@ public sealed class ConfigureIndexOptions : IConfigureNamedOptions<LuceneDirecto
@@ -215,71 +198,88 @@ That returns an result [`ValueSetValidationResult`](xref:Examine.ValueSetValidat
215
198
216
199
Examine only has one implementation: [`ValueSetValidatorDelegate`](xref:Examine.Lucene.Providers.ValueSetValidatorDelegate) which can be used by developers as a simple way to create a validator based on a callback, else developers can implement this interface if required. By default, no ValueSet validation is done with Examine.
217
200
201
+
## Index behavior options
202
+
203
+
[`LuceneIndexOptions`](xref:Examine.Lucene.LuceneIndexOptions) also controls how the underlying Lucene index reader and writer behave. These are set the same way as any other option.
204
+
205
+
*__NrtEnabled___`bool`_ - Whether Near Real-Time (NRT) searching is enabled. Default `true`. With NRT enabled, searchers see indexed documents without waiting for a commit.
206
+
*__NrtTargetMinStaleSec___`double`_ - The lower staleness bound for NRT reopens, in seconds. Default `1.0`.
207
+
*__NrtTargetMaxStaleSec___`double`_ - The upper staleness bound for NRT reopens, in seconds. Default `60.0`.
208
+
*__NrtCacheMaxMergeSizeMB___`double`_ - Maximum merge size in megabytes held in the NRT cache. Default `5.0`.
209
+
*__NrtCacheMaxCachedMB___`double`_ - Maximum total megabytes held in the NRT cache. Default `60.0`.
210
+
*__IndexDeletionPolicy___`IndexDeletionPolicy`_ - The Lucene index deletion policy. Required when [replicating](xref:replication) an index.
211
+
*__UnlockIndex___`bool`_ - On [`LuceneDirectoryIndexOptions`](xref:Examine.Lucene.LuceneDirectoryIndexOptions). If `true`, forcibly unlocks the index directory on startup.
212
+
*__DirectoryFactory___[`IDirectoryFactory`](xref:Examine.Lucene.Directories.IDirectoryFactory)_ - On [`LuceneDirectoryIndexOptions`](xref:Examine.Lucene.LuceneDirectoryIndexOptions). Determines the Lucene `Directory` backing the index.
// Reopen the searcher more aggressively than the default
218
+
options.NrtTargetMinStaleSec=0.5;
219
+
options.NrtTargetMaxStaleSec=10.0;
220
+
});
221
+
```
222
+
223
+
Lowering the staleness targets makes newly indexed documents searchable sooner at the cost of more frequent reader reopens.
224
+
218
225
## Facets configuration
219
226
220
227
When using the facets feature it's possible to add facets configuration to change the behavior of the indexing.
221
228
222
229
For example, you can allow multiple values in an indexed field with the configuration below.
223
230
```csharp
224
-
// Create a config
225
-
varfacetsConfig=newFacetsConfig();
226
-
227
-
// Set field to be able to contain multiple values (This is default for a field in Examine. But you only need this if you are actually using multiple values for a single field)
Without this configuration for multiple values, you'll notice that your faceted search breaks or behaves differently than expected.
243
245
244
246
### Hierarchical and Taxonomy Facets configuration
245
247
246
-
To enable support for hierarchical facets as well as supporting faster faceting the Taxonomy Facet sidecar index can be enabled.
248
+
To enable support for hierarchical facets as well as supporting faster faceting the Taxonomy Facet sidecar index can be used.
249
+
250
+
[`LuceneIndexOptions.UseTaxonomyIndex`](xref:Examine.Lucene.LuceneIndexOptions#Examine_Lucene_LuceneIndexOptions_UseTaxonomyIndex) is __`true` by default__. Setting it to `false` switches faceting over to `SortedSetDocValues` and no sidecar index is written.
247
251
248
-
1.Set LuceneIndexOptions.UseTaxonomyIndex = true; for the index. This enables the use of the Taxonomy sidecar index.
249
-
2. Change the Field Definitions to use the "FacetTaxonomy" Field Definition Types instead of the "Facet" types. E.g. FieldDefinitionTypes.FacetFullText => FieldDefinitionTypes.FacetTaxonomyFullText.
250
-
3. To enable hierarchical facets on a field, call FacetsConfig.SetHierarchical("facetfieldname", true);
252
+
1.Leave `LuceneIndexOptions.UseTaxonomyIndex` as `true` for the index (or set it explicitly).
253
+
2. Change the Field Definitions to use the "FacetTaxonomy" Field Definition Types instead of the "Facet" types. E.g. `FieldDefinitionTypes.FacetFullText` => `FieldDefinitionTypes.FacetTaxonomyFullText`.
254
+
3. To enable hierarchical facets on a field, call `FacetsConfig.SetHierarchical("facetfieldname", true)`.
251
255
252
256
Example:
253
257
254
258
```csharp
255
-
// Create a config
256
-
varfacetsConfig=newFacetsConfig();
257
-
258
-
// Set field to be able to support hierarchical facets
// Set field to be able to contain multiple values (This is default for a field in Examine. But you only need this if you are actually using multiple values for a single field)
IfusingExaminewiththedefaultLuceneimplementationthenthe [`IIndex`](xref:Examine.IIndex) implementationwillbe [`LuceneIndex`](xref:Examine.Lucene.Providers.LuceneIndex). ThiseventprovidesaccesstotheLucene [`Document`](https://lucenenet.apache.org/docs/4.8.0-beta00016/api/core/Lucene.Net.Documents.Document.html) object before it gets added to the Lucene Index.
211
+
IfusingExaminewiththedefaultLuceneimplementationthenthe [`IIndex`](xref:Examine.IIndex) implementationwillbe [`LuceneIndex`](xref:Examine.Lucene.Providers.LuceneIndex). ThiseventprovidesaccesstotheLucene [`Document`](https://lucenenet.apache.org/docs/4.8.0-beta00018/api/core/Lucene.Net.Documents.Document.html) object before it gets added to the Lucene Index.
212
212
213
-
YoucanusethiseventtoentirelycustomizehowthedataisstoredintheLuceneindex, includingaddingcustomboostingprofiles, changingthe [`Document`](https://lucenenet.apache.org/docs/4.8.0-beta00016/api/core/Lucene.Net.Documents.Document.html)'s field values or types, etc...
213
+
YoucanusethiseventtoentirelycustomizehowthedataisstoredintheLuceneindex, includingaddingcustomboostingprofiles, changingthe [`Document`](https://lucenenet.apache.org/docs/4.8.0-beta00018/api/core/Lucene.Net.Documents.Document.html)'s field values or types, etc...
0 commit comments