From b6da7abf788504a42d24163656228caf75853dfc Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Wed, 27 Sep 2023 13:46:28 +0200 Subject: [PATCH 1/5] Update docs about facets --- docs/searching.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/searching.md b/docs/searching.md index 949a83a6e..13be5e31f 100644 --- a/docs/searching.md +++ b/docs/searching.md @@ -260,7 +260,7 @@ Basic example var searcher = myIndex.Searcher; var results = searcher.CreateQuery() .Field("Address", "Hills") - .WithFacets(facets => facets.Facet("Address")) // Get facets of the Address field + .WithFacets(facets => facets.FacetString("Address")) // Get facets of the Address field .Execute(); var addressFacetResults = results.GetFacet("Address"); // Returns the facets for the specific field Address @@ -279,7 +279,7 @@ Filtered value example var searcher = myIndex.Searcher; var results = searcher.CreateQuery() .Field("Address", "Hills") - .WithFacets(facets => facets.Facet("Address", "Hills")) // Get facets of the Address field + .WithFacets(facets => facets.FacetString("Address", "Hills")) // Get facets of the Address field with specific value .Execute(); var addressFacetResults = results.GetFacet("Address"); // Returns the facets for the specific field Address @@ -289,7 +289,7 @@ var addressFacetResults = results.GetFacet("Address"); // Returns the facets for * Label: Hills, Value: 2 <-- As Hills was the only filtered value we will only get this facet */ -var hillsValue = addressFacetResults.Facet("Hills"); // Gets the IFacetValue for the facet Hills +var hillsValue = addressFacetResults.FacetString("Hills"); // Gets the IFacetValue for the facet Hills ``` MaxCount example @@ -297,7 +297,7 @@ MaxCount example var searcher = myIndex.Searcher; var results = searcher.CreateQuery() .Field("Address", "Hills") - .WithFacets(facets => facets.Facet("Address")) // Get facets of the Address field + .WithFacets(facets => facets.FacetString("Address")) // Get facets of the Address field .Execute(); var addressFacetResults = results.GetFacet("Address"); // Returns the facets for the specific field Address @@ -311,7 +311,7 @@ var addressFacetResults = results.GetFacet("Address"); // Returns the facets for results = searcher.CreateQuery() .Field("Address", "Hills") - .WithFacets(facets => facets.Facet("Address", config => config.MaxCount(2))) // Get facets of the Address field & Gets the top 2 results (The facets with the highest value) + .WithFacets(facets => facets.FacetString("Address", config => config.MaxCount(2))) // Get facets of the Address field & Gets the top 2 results (The facets with the highest value) .Execute(); addressFacetResults = results.GetFacet("Address"); // Returns the facets for the specific field Address @@ -450,4 +450,4 @@ var createdFacetResults = results.GetFacet("Created"); // Returns the facets for */ var firstRangeValue = createdFacetResults.Facet("first"); // Gets the IFacetValue for the facet "first" -``` \ No newline at end of file +``` From 0c91439a4918810d9d8506575ac6e639cce3231a Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Wed, 27 Sep 2023 13:50:36 +0200 Subject: [PATCH 2/5] Update facet range --- docs/searching.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/searching.md b/docs/searching.md index 13be5e31f..497089e07 100644 --- a/docs/searching.md +++ b/docs/searching.md @@ -346,7 +346,7 @@ services.AddExamineLuceneIndex("MyIndex", var searcher = myIndex.Searcher; var results = searcher.CreateQuery() .Field("Address", "Hills") - .WithFacets(facets => facets.Facet("Address")) // Get facets of the Address field from the facet field address_facet (The facet field is automatically read from the FacetsConfig) + .WithFacets(facets => facets.FacetString("Address")) // Get facets of the Address field from the facet field address_facet (The facet field is automatically read from the FacetsConfig) .Execute(); var addressFacetResults = results.GetFacet("Address"); // Returns the facets for the specific field Address @@ -369,7 +369,7 @@ Double range example var searcher = myIndex.Searcher; var results = searcher.CreateQuery() .All() - .WithFacets(facets => facets.Facet("Price", new DoubleRange[] { + .WithFacets(facets => facets.FacetDoubleRange("Price", new DoubleRange[] { new DoubleRange("0-10", 0, true, 10, true), new DoubleRange("11-20", 11, true, 20, true) })) // Get facets of the price field @@ -391,7 +391,7 @@ Float range example var searcher = myIndex.Searcher; var results = searcher.CreateQuery() .All() - .WithFacets(facets => facets.Facet("Price", new FloatRange[] { + .WithFacets(facets => facets.FacetFloatRange("Price", new FloatRange[] { new FloatRange("0-10", 0, true, 10, true), new FloatRange("11-20", 11, true, 20, true) })) // Get facets of the price field @@ -413,7 +413,7 @@ Int/Long range example var searcher = myIndex.Searcher; var results = searcher.CreateQuery() .All() - .WithFacets(facets => facets.Facet("Price", new Int64Range[] { + .WithFacets(facets => facets.FacetLongRange("Price", new Int64Range[] { new Int64Range("0-10", 0, true, 10, true), new Int64Range("11-20", 11, true, 20, true) })) // Get facets of the price field @@ -435,7 +435,7 @@ DateTime range example var searcher = myIndex.Searcher; var results = searcher.CreateQuery() .All() - .WithFacets(facets => facets.Facet("Created", new Int64Range[] { + .WithFacets(facets => facets.FacetLongRange("Created", new Int64Range[] { new Int64Range("first", DateTime.UtcNow.AddDays(-1).Ticks, true, DateTime.UtcNow.Ticks, true), new Int64Range("last", DateTime.UtcNow.AddDays(1).Ticks, true, DateTime.UtcNow.AddDays(2).Ticks, true) })) // Get facets of the price field From 15d4608eac70a419307206033895ae8143025c0d Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Wed, 27 Sep 2023 13:52:19 +0200 Subject: [PATCH 3/5] Update facet with specific value --- docs/searching.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/searching.md b/docs/searching.md index 497089e07..a38e34d1b 100644 --- a/docs/searching.md +++ b/docs/searching.md @@ -279,7 +279,7 @@ Filtered value example var searcher = myIndex.Searcher; var results = searcher.CreateQuery() .Field("Address", "Hills") - .WithFacets(facets => facets.FacetString("Address", "Hills")) // Get facets of the Address field with specific value + .WithFacets(facets => facets.FacetString("Address", null, new[] { "Hills" })) // Get facets of the Address field with specific value .Execute(); var addressFacetResults = results.GetFacet("Address"); // Returns the facets for the specific field Address From 8d1315979c55c9bfccd524f3b4cd6b1ab7b25757 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Wed, 27 Sep 2023 14:24:07 +0200 Subject: [PATCH 4/5] Update DoubleRange --- docs/searching.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/searching.md b/docs/searching.md index a38e34d1b..43fec8ecd 100644 --- a/docs/searching.md +++ b/docs/searching.md @@ -362,7 +362,7 @@ var addressFacetResults = results.GetFacet("Address"); // Returns the facets for Numeric range facets can be used with numbers and get facets for numeric ranges. For example, it would group documents of the same price range. -There's two categories of numeric ranges - `DoubleRanges` and `Int64Range` for double/float values and int/long/datetime values respectively. +There's two categories of numeric ranges - `DoubleRange` and `Int64Range` for double/float values and int/long/datetime values respectively. Double range example ```csharp From bb095953ecb22a6fb34a4700cae4939131f994de Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Wed, 27 Sep 2023 23:10:07 +0200 Subject: [PATCH 5/5] Update facet range types --- docs/searching.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/searching.md b/docs/searching.md index 43fec8ecd..496cecd15 100644 --- a/docs/searching.md +++ b/docs/searching.md @@ -362,7 +362,7 @@ var addressFacetResults = results.GetFacet("Address"); // Returns the facets for Numeric range facets can be used with numbers and get facets for numeric ranges. For example, it would group documents of the same price range. -There's two categories of numeric ranges - `DoubleRange` and `Int64Range` for double/float values and int/long/datetime values respectively. +There's three categories of numeric ranges - `DoubleRange`, `FloatRange` and `Int64Range` for double, float and int/long/datetime values respectively. Double range example ```csharp