Skip to content

Commit

Permalink
[Orckestra.Search.LuceneNET] 1.2.1: Adding scoring and score explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
napernik committed Apr 4, 2022
1 parent feafbb1 commit 81da1d2
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ private SearchResult Search(SearchQuery searchQuery, Directory directory)
{
Query = query,
Offset = searchQuery.SearchResultOffset,
Count = searchQuery.MaxDocumentsNumber
Count = searchQuery.MaxDocumentsNumber,
ShowExplanation = searchQuery.ShowExplanation
};

if (searchQuery.Selection != null)
Expand Down Expand Up @@ -337,9 +338,9 @@ private ICollection<SearchResultItem> ToSearchDocuments(
Action<SearchResultItem, Document> buildHighlights)
{
var resultDocs = new List<SearchResultItem>(hits.Length);
var docs = hits.Select(h => reader.Document(h.DocId));
var hitsWithDocuments = hits.Select(browseHit => (Hit: browseHit, Doc: reader.Document(browseHit.DocId)));

foreach (var document in docs)
foreach (var (hit, document) in hitsWithDocuments)
{
var fieldValues = new Dictionary<string, object>();
foreach (var field in document.GetFields().Where(f => f.Name.StartsWith(Constants.PreviewFieldPrefix)))
Expand All @@ -361,8 +362,10 @@ private ICollection<SearchResultItem> ToSearchDocuments(
{
ElementBundleName = GetString(Constants.FieldNames.version),
Url = GetString(Constants.FieldNames.url),
FieldValues = fieldValues
}
FieldValues = fieldValues,
},
Score = hit.Score,
ExplanationSummary = hit.Explanation?.ToString()
};

buildHighlights?.Invoke(resultLine, document);
Expand All @@ -373,6 +376,7 @@ private ICollection<SearchResultItem> ToSearchDocuments(
return resultDocs;
}


private Dictionary<string, Facet[]> GetFacets(BrowseResult browseResult)
{
var facets = new Dictionary<string, Facet[]>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<HintPath>..\packages\Common.Logging.Core.3.0.0\lib\net40\Common.Logging.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Composite, Version=6.11.7982.26191, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C1CMS.Assemblies.6.11.7982.26191\lib\net471\Composite.dll</HintPath>
<Reference Include="Composite, Version=6.12.8122.18346, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C1CMS.Assemblies.6.12.8122.18346\lib\net471\Composite.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Lucene.Net, Version=3.0.3.0, Culture=neutral, PublicKeyToken=85089178b9ac3181, processorArchitecture=MSIL">
Expand All @@ -66,11 +66,11 @@
<HintPath>..\packages\Lucene.Net.Contrib.3.0.3\lib\net40\Lucene.Net.Contrib.Snowball.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\C1CMS.Assemblies.6.11.7982.26191\lib\net471\Microsoft.Extensions.DependencyInjection.dll</HintPath>
<HintPath>..\packages\C1CMS.Assemblies.6.12.8122.18346\lib\net471\Microsoft.Extensions.DependencyInjection.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\C1CMS.Assemblies.6.11.7982.26191\lib\net471\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
<HintPath>..\packages\C1CMS.Assemblies.6.12.8122.18346\lib\net471\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BoboBrowse.Net" version="3.2.2" targetFramework="net461" />
<package id="C1CMS.Assemblies" version="6.11.7982.26191" targetFramework="net48" />
<package id="C1CMS.Assemblies" version="6.12.8122.18346" targetFramework="net48" />
<package id="C5" version="2.2.4822.42600" targetFramework="net461" />
<package id="Common.Logging" version="3.0.0" targetFramework="net461" />
<package id="Common.Logging.Core" version="3.0.0" targetFramework="net461" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Composite, Version=6.11.7982.26191, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C1CMS.Assemblies.6.11.7982.26191\lib\net471\Composite.dll</HintPath>
<Reference Include="Composite, Version=6.12.8122.18346, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C1CMS.Assemblies.6.12.8122.18346\lib\net471\Composite.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\C1CMS.Assemblies.6.11.7982.26191\lib\net471\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
<HintPath>..\packages\C1CMS.Assemblies.6.12.8122.18346\lib\net471\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Orckestra A/S")]
[assembly: AssemblyProduct("Orckestra.Search")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("fa946885-df5b-4bd9-89d2-b1fb20213fa2")]

[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="C1CMS.Assemblies" version="6.11.7982.26191" targetFramework="net48" />
<package id="C1CMS.Assemblies" version="6.12.8122.18346" targetFramework="net48" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net48" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net48" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.1.0" targetFramework="net461" />
Expand Down
4 changes: 2 additions & 2 deletions Orckestra.Search.LuceneNET/Package/Package/install.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" standalone="yes"?>
<mi:PackageInstaller xmlns:mi="http://www.composite.net/ns/management/packageinstaller/1.0">
<mi:PackageRequirements minimumCompositeVersion="6.11.0.0" maximumCompositeVersion="9.9999.9999.9999" />
<mi:PackageInformation name="Orckestra.Search.LuceneNET" groupName="Orckestra.Search" version="1.2"
<mi:PackageRequirements minimumCompositeVersion="6.12.0.0" maximumCompositeVersion="9.9999.9999.9999" />
<mi:PackageInformation name="Orckestra.Search.LuceneNET" groupName="Orckestra.Search" version="1.2.1"
author="Orckestra A/S" website="https://c1.orckestra.com" readMoreUrl="https://docs.c1.orckestra.com/Orckestra.Search.LuceneNET"
id="62a2e5bd-b54f-4d3c-8dfd-70fbb7902285" canBeUninstalled="true" systemLocking="hard"
flushOnCompletion="true" reloadConsoleOnCompletion="true">
Expand Down

0 comments on commit 81da1d2

Please sign in to comment.