Skip to content
This repository was archived by the owner on Jun 1, 2024. It is now read-only.

Commit e30382d

Browse files
committed
Release 1.0.0
1 parent dbb2458 commit e30382d

File tree

3 files changed

+95
-4
lines changed

3 files changed

+95
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/).
66

7-
## [1.0.0] - 2020-08-10
7+
## [1.0.0] - 2020-08-12
88
### Added
99
* Initial release of Examine Facets
10+
* Support for BoboBrowse.Net
11+
* Support for MultiFacetsLucene.Net
12+
* Documentation for configuration and querying
1013

1114
[Unreleased]: https://github.com/callumbwhyte/examine-facets/compare/release-1.0.0...HEAD

README.md

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Examine Facets
22

3-
[![NuGet](https://img.shields.io/nuget/v/Examine.Facets.svg)](https://www.nuget.org/packages/Examine.Facets/)
3+
Powerful filtering and faceting directly within the [Examine](https://github.com/shazwazza/examine) fluent API.
44

5-
Facet search results directly within the Examine fluent API.
5+
| Package | NuGet |
6+
|----------------------------|-------------------|
7+
| Examine.Facets | [![NuGet](https://img.shields.io/nuget/v/Examine.Facets.svg)](https://www.nuget.org/packages/Examine.Facets/) |
8+
| Examine.Facets.BoboBrowse | [![NuGet](https://img.shields.io/nuget/v/Examine.Facets.BoboBrowse.svg)](https://www.nuget.org/packages/Examine.Facets.BoboBrowse/) |
9+
| Examine.Facets.MultiFacets | [![NuGet](https://img.shields.io/nuget/v/Examine.Facets.MultiFacets.svg)](https://www.nuget.org/packages/Examine.Facets.MultiFacets/) |
610

711
## Getting started
812

@@ -18,6 +22,82 @@ To [install from NuGet](https://www.nuget.org/packages/Examine.Facets/), run the
1822

1923
PM> Install-Package Examine.Facets
2024

25+
## Usage
26+
27+
Examine Facets integrates seamlessly with the Examine API. *Read the [Examine docs](https://shazwazza.github.io/Examine/) first.*
28+
29+
### Register the searcher
30+
31+
There are 2 facet engines available out of the box: [Bobo Browse](https://www.nuget.org/packages/Examine.Facets.BoboBrowse/) and [Multi Facets](https://www.nuget.org/packages/Examine.Facets.MultiFacets/). Both offer a similar choice of features and performance so it is really a matter of preference.
32+
33+
To perform facet queries the chosen facet engine's Searcher must be registered via `ExamineManager`. This requires only a few lines of configuration code.
34+
35+
For example the [Bobo Browse](https://www.nuget.org/packages/Examine.Facets.BoboBrowse/) Searcher can be registered like this:
36+
37+
```
38+
if (_examineManager.TryGetIndex("CustomIndex", out IIndex index))
39+
{
40+
if (index is LuceneIndex luceneIndex)
41+
{
42+
var searcher = new BoboFacetSearcher(
43+
"FacetSearcher",
44+
luceneIndex.GetIndexWriter(),
45+
luceneIndex.DefaultAnalyzer,
46+
luceneIndex.FieldValueTypeCollection
47+
);
48+
49+
_examineManager.AddSearcher(searcher);
50+
}
51+
}
52+
```
53+
54+
### Querying
55+
56+
Defining and querying facets is baked right into Examine's fluent API.
57+
58+
Begin a facet query by calling `.Facet(string field)` within a query, or filter results to a facet with a specific value by calling `.Facet(string field, string[] values)`.
59+
60+
Further optional configuration – such as the minimum number of matches required for a facet to appear, or the maximum number of values to return – can also be configured configured through the fluent API.
61+
62+
```
63+
_examineManager.TryGetSearcher("FacetSearcher", out ISearcher searcher);
64+
65+
var query = searcher.CreateQuery();
66+
67+
query.And()
68+
.Facet("CustomField")
69+
.MinHits(10)
70+
.MaxCount(100);
71+
```
72+
73+
### Results
74+
75+
Facet searches behave the same as any other Examine search. To retreive information about facets there are some handy extension methods.
76+
77+
```
78+
var results = searcher.Execute();
79+
```
80+
81+
To get a list of all facets:
82+
83+
```
84+
results.GetFacets();
85+
```
86+
87+
To get a list of values for a specific facet:
88+
89+
```
90+
results.GetFacet(string field);
91+
```
92+
93+
To get the number of hits for a specific value:
94+
95+
```
96+
results
97+
.GetFacet(string field)
98+
.GetHits(object value);
99+
```
100+
21101
## Contribution guidelines
22102

23103
To raise a new bug, create an issue on the GitHub repository. To fix a bug or add new features, fork the repository and send a pull request with your changes. Feel free to add ideas to the repository's issues list if you would to discuss anything related to the library.
@@ -26,6 +106,14 @@ To raise a new bug, create an issue on the GitHub repository. To fix a bug or ad
26106

27107
This project is maintained by [Callum Whyte](https://callumwhyte.com/) and contributors. If you have any questions about the project please get in touch on [Twitter](https://twitter.com/callumbwhyte), or by raising an issue on GitHub.
28108

109+
## Credits
110+
111+
[Examine](https://github.com/shazwazza/examine) was created by [Shannon Deminick](https://github.com/shazwazza) and is licensed under [Microsoft Public License (MS-PL)](https://opensource.org/licenses/ms-pl).
112+
113+
[BoboBrowse.Net](https://github.com/NightOwl888/BoboBrowse.Net) was created by [Shad Storhaug](https://github.com/NightOwl888) and is licensed under [Apache License 2.0](https://github.com/NightOwl888/BoboBrowse.Net/blob/master/LICENSE.md).
114+
115+
[MultiFacetLucene.Net](https://github.com/aspcodenet/MultiFacetLuceneNet) was created by [Stefan Holmberg](https://github.com/aspcodenet).
116+
29117
## License
30118

31119
Copyright © 2020 [Callum Whyte](https://callumwhyte.com/), and other contributors

src/Examine.Facets/Examine.Facets.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFramework>net452</TargetFramework>
44
<Version Condition="'$(BUILD_BUILDNUMBER)' == ''">1.0.0.0</Version>
55
<Version Condition="'$(BUILD_BUILDNUMBER)' != ''">$(BUILD_BUILDNUMBER)</Version>
6-
<Description>Facet search results directly within the Examine fluent API</Description>
6+
<Description>Powerful filtering and faceting directly within the Examine fluent API</Description>
77
<Authors>Callum Whyte</Authors>
88
<Copyright>Copyright © 2020 Callum Whyte, and other contributors</Copyright>
99
<PackageIconUrl>https://raw.githubusercontent.com/callumbwhyte/examine-facets/main/docs/img/logo.png</PackageIconUrl>

0 commit comments

Comments
 (0)