Skip to content

Commit

Permalink
Update configuration.md
Browse files Browse the repository at this point in the history
removes the after construction part of customizing index fields
  • Loading branch information
Shazwazza authored May 23, 2024
1 parent 9f29ee8 commit b0c06b8
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions docs/articles/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,39 +52,6 @@ public sealed class ConfigureIndexOptions : IConfigureNamedOptions<LuceneDirecto
}
```

### After construction

You can modify the field definitions [FieldDefinitionCollection](xref:Examine.FieldDefinitionCollection) for an index after it is constructed by using any of the following methods:

* `myIndex.FieldDefinitionCollection.TryAdd`
* `myIndex.FieldDefinitionCollection.AddOrUpdate`
* `myIndex.FieldDefinitionCollection.GetOrAdd`

These modifications __must__ be done before any indexing or searching is executed.

### Add a field value type after construction

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.

```cs
// Create the index with all of the defaults
var myIndex = new LuceneIndex(
"MyIndex",
new SimpleFSDirectory(new DirectoryInfo("C:\\TestIndexes")));

// Add a custom field value type
myIndex.FieldValueTypeCollection.ValueTypeFactories
.TryAdd(
"phonenumber",
name => new GenericAnalyzerFieldValueType(
name,
new PhoneNumberAnalyzer()));

// Map a field to use the custom field value type
myIndex.FieldDefinitionCollection.TryAdd(
new FieldDefinition("Phone", "phonenumber"));
```

## Value types

Value types are responsible for:
Expand Down Expand Up @@ -284,4 +251,4 @@ To explore other configuration settings see the links below:

## Luke
Lucene.NET 4.8 is compatible with Java Luke 4.8.0, a useful tool for working with Lucene Indexes. Newer versions of Luke can't be used with Lucene.NET 4.8 indexes.
[Luke 4.8.0](https://github.com/DmitryKey/luke/releases/download/4.8.0/luke-with-deps.jar)
[Luke 4.8.0](https://github.com/DmitryKey/luke/releases/download/4.8.0/luke-with-deps.jar)

0 comments on commit b0c06b8

Please sign in to comment.