Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of Facets (#310) #311

Merged
merged 46 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
585033e
wip; Implementation of Facets
nikcio Nov 14, 2022
e872fa3
wip: Implementation Examine facets
nikcio Nov 15, 2022
aa3f545
wip: Implementation Examine facets
nikcio Nov 15, 2022
a36d0a3
test: Facet tests
nikcio Nov 15, 2022
108dd96
fix: FacetsConfig
nikcio Nov 16, 2022
c00f3ab
test: Added remaining facet fluent api tests
nikcio Nov 16, 2022
81e170e
docs: Added facet docs
nikcio Nov 23, 2022
a0faff0
Merge remote-tracking branch 'upstream/release/3.0' into feat/facets
nikcio Dec 6, 2022
f15f3a4
refactor: ReadOnly collections
nikcio Dec 13, 2022
7b50317
refactor: Use params in facets
nikcio Dec 13, 2022
45986b5
refactor: Facet to WithFacet
nikcio Dec 13, 2022
4d7cddd
docs: Update Facet to WithFacet
nikcio Dec 13, 2022
43f73a7
refactor: Move facet operations to different interface
nikcio Dec 13, 2022
e4db510
test: Fix test
nikcio Dec 13, 2022
f68878f
test: Refactor facets tests to be part of fluentApiTests
nikcio Dec 14, 2022
8d7a9d9
docs: Update code examples
nikcio Dec 15, 2022
5a9cd43
refactor: Use default facets name constant for FacetField
nikcio Dec 15, 2022
a079aaa
refactor: Remove Lucene.Net.Facet from core project
nikcio Dec 15, 2022
0efd647
feat: Add FacetField methods to long and double fields
nikcio Dec 16, 2022
ff35df5
refactor: Ranges immutable properties
nikcio Dec 21, 2022
3974b06
refactor Range to readonly structs
nikcio Dec 21, 2022
a4c5fa8
refactor: FloatRange, immutable properties & structs
nikcio Dec 21, 2022
f2f9bc9
refactor: Encapsulate facets in query
nikcio Dec 21, 2022
e62b355
docs: Update facet docs with refactored code
nikcio Dec 21, 2022
afd0341
refactor: Refactored facetfield
nikcio Dec 21, 2022
e88da28
refactor: Correct Empty in LuceneSearchResults
nikcio Dec 21, 2022
9804902
chore: Unused using
nikcio Dec 21, 2022
6b19575
refactor: Namespace alignment & Use interface field
nikcio Dec 21, 2022
67902fd
refactor: Move FacetQueryField concrete type to Core
nikcio Dec 21, 2022
1a58a38
refactor: Remove field interfaces
nikcio Dec 21, 2022
d8ab112
docs: Update code examples from refactor
nikcio Dec 21, 2022
7bddef8
perf: Add dictionary to look up facet result
nikcio Dec 28, 2022
9a546ec
refactor: Combine facetable types with the standard types
nikcio Dec 28, 2022
8ac423f
refactor: Move facet extraction
nikcio Jan 2, 2023
da5171d
Fix ctor overloads for backward compat
Shazwazza Feb 15, 2023
93150d6
Merge branch 'feat/facets' into feat/facets-iindexRangeValueType
Shazwazza Feb 15, 2023
ec47063
return a collection instead of modifying existing.
Shazwazza Feb 15, 2023
ae085e6
Removes breaking change and moves to ext method
Shazwazza Feb 15, 2023
fdf99ba
Add missing interface
nzdev Mar 20, 2023
1b08a17
fix test
nzdev Mar 20, 2023
226245e
Introduce IFacetExtractionContext
nzdev Mar 20, 2023
f58f672
Support facet extraction
nzdev Mar 20, 2023
838ee06
path support
nzdev Mar 20, 2023
e23a8cb
params
nzdev Mar 20, 2023
f61d5f8
Merge pull request #4 from nzdev/feat/facets-impl
nikcio Apr 12, 2023
2a5d67b
Merge pull request #5 from nzdev/feat/facets-extensions
nikcio Apr 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 61 additions & 17 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,35 @@ Value types are responsible for:

These are the default field value types provided with Examine. Each value type can be resolved from the static class `Examine.FieldDefinitionTypes` (i.e. `Examine.FieldDefinitionTypes.FullText`).

| Value Type | Description | Sortable |
|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
| FullText | __Default__.<br />The field will be indexed with the index's <br />default Analyzer without any sortability. <br />Generally this is fine for normal text searching. | ❌ |
| FullTextSortable | Will be indexed with FullText but also <br />enable sorting on this field for search results. <br />_FullText sortability adds additional overhead <br />since it requires an additional index field._ | ✅ |
| Integer | Stored as a numerical structure. | ✅ |
| Float | Stored as a numerical structure. | ✅ |
| Double | Stored as a numerical structure. | ✅ |
| Long | Stored as a numerical structure. | ✅ |
| DateTime | Stored as a DateTime, <br />represented by a numerical structure. | ✅ |
| DateYear | Just like DateTime but with <br />precision only to the year. | ✅ |
| DateMonth | Just like DateTime but with <br />precision only to the month. | ✅ |
| DateDay | Just like DateTime but with <br />precision only to the day. | ✅ |
| DateHour | Just like DateTime but with <br />precision only to the hour. | ✅ |
| DateMinute | Just like DateTime but with <br />precision only to the minute. | ✅ |
| EmailAddress | Uses custom analyzers for dealing <br />with email address searching. | ❌ |
| InvariantCultureIgnoreCase | Uses custom analyzers for dealing with text so it<br /> can be searched on regardless of the culture/casing. | ❌ |
| Raw | Will be indexed without analysis, searching will<br /> only match with an exact value. | ❌ |
| Value Type | Description | Sortable | Facetable |
|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|-------------|
| FullText | __Default__.<br />The field will be indexed with the index's <br />default Analyzer without any sortability. <br />Generally this is fine for normal text searching. | ❌ | ❌ |
| FullTextSortable | Will be indexed with FullText but also <br />enable sorting on this field for search results. <br />_FullText sortability adds additional overhead <br />since it requires an additional index field._ | ✅ | ❌ |
| Integer | Stored as a numerical structure. | ✅ | ❌ |
| Float | Stored as a numerical structure. | ✅ | ❌ |
| Double | Stored as a numerical structure. | ✅ | ❌ |
| Long | Stored as a numerical structure. | ✅ | ❌ |
| DateTime | Stored as a DateTime, <br />represented by a numerical structure. | ✅ | ❌ |
| DateYear | Just like DateTime but with <br />precision only to the year. | ✅ | ❌ |
| DateMonth | Just like DateTime but with <br />precision only to the month. | ✅ | ❌ |
| DateDay | Just like DateTime but with <br />precision only to the day. | ✅ | ❌ |
| DateHour | Just like DateTime but with <br />precision only to the hour. | ✅ | ❌ |
| DateMinute | Just like DateTime but with <br />precision only to the minute. | ✅ | ❌ |
| FacetFullText | The field will be indexed with the index's <br />default Analyzer without any sortability. <br />Generally this is fine for normal text searching. | ❌ | ✅ |
| FacetFullTextSortable | Will be indexed with FullText but also <br />enable sorting on this field for search results. <br />_FullText sortability adds additional overhead <br />since it requires an additional index field._ | ✅ | ✅ |
| FacetInteger | Stored as a numerical structure. | ✅ | ✅ |
| FacetFloat | Stored as a numerical structure. | ✅ | ✅ |
| FacetDouble | Stored as a numerical structure. | ✅ | ✅ |
| FacetLong | Stored as a numerical structure. | ✅ | ✅ |
| FacetDateTime | Stored as a DateTime, <br />represented by a numerical structure. | ✅ | ✅ |
| FacetDateYear | Just like DateTime but with <br />precision only to the year. | ✅ | ✅ |
| FacetDateMonth | Just like DateTime but with <br />precision only to the month. | ✅ | ✅ |
| FacetDateDay | Just like DateTime but with <br />precision only to the day. | ✅ | ✅ |
| FacetDateHour | Just like DateTime but with <br />precision only to the hour. | ✅ | ✅ |
| FacetDateMinute | Just like DateTime but with <br />precision only to the minute. | ✅ | ✅ |
| EmailAddress | Uses custom analyzers for dealing <br />with email address searching. | ❌ | ❌ |
| InvariantCultureIgnoreCase | Uses custom analyzers for dealing with text so it<br /> can be searched on regardless of the culture/casing. | ❌ | ❌ |
| Raw | Will be indexed without analysis, searching will<br /> only match with an exact value. | ❌ | ❌ |

### Custom field value types

Expand Down Expand Up @@ -273,3 +285,35 @@ That returns an enum `ValueSetValidationResult` of values:
* `Filtered` - The ValueSet has been filtered/modified by the validator and will be indexed

Examine only has one implementation: `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.

## Facets configuration

When using the facets feature it's possible to add facets configuration to change the behavior of the indexing.

For example, you can allow multiple values in an indexed field with the configuration below.
```csharp
// Create a config
var facetsConfig = new FacetsConfig();

// 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)
facetsConfig.SetMultiValued("MultiIdField", true);

services.AddExamineLuceneIndex("MyIndex",
// Set the indexing of your fields to use the facet type
fieldDefinitions: new FieldDefinitionCollection(
new FieldDefinition("Timestamp", FieldDefinitionTypes.FacetDateTime),

new FieldDefinition("MultiIdField", FieldDefinitionTypes.FacetFullText)
),
// Pass your config
facetsConfig: facetsConfig
);
```

Without this configuration for multiple values, you'll notice that your faceted search breaks or behaves differently than expected.

**Note: See more examples of how facets configuration can be used under 'Searching'**

To explore other configuration settings see the links below:
- [FacetsConfig API docs](https://lucenenet.apache.org/docs/4.8.0-beta00016/api/facet/Lucene.Net.Facet.FacetsConfig.html#methods)
- [Facets with lucene](https://norconex.com/facets-with-lucene/). See how the config is used in the code examples.
Loading