Skip to content

Commit

Permalink
Regression fix: searcher skip 10k not possible (#17977)
Browse files Browse the repository at this point in the history
* Add new examine lucene option to restore functionality of earlier version

* Add reason comment for maxSkipTake
  • Loading branch information
Migaroez authored Jan 20, 2025
1 parent dab9323 commit 0e06c47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<PackageVersion Include="Asp.Versioning.Mvc" Version="8.1.0" />
<PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
<PackageVersion Include="Dazinator.Extensions.FileProviders" Version="2.0.0" />
<PackageVersion Include="Examine" Version="3.5.0" />
<PackageVersion Include="Examine" Version="3.6.0" />
<PackageVersion Include="Examine.Core" Version="3.5.0" />
<PackageVersion Include="HtmlAgilityPack" Version="1.11.71" />
<PackageVersion Include="JsonPatch.Net" Version="3.1.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Asp.Versioning;
using Examine;
using Examine.Lucene.Search;
using Examine.Search;
using Lucene.Net.QueryParsers.Classic;
using Microsoft.AspNetCore.Http;
Expand Down Expand Up @@ -52,12 +53,13 @@ public async Task<ActionResult<PagedViewModel<SearchResultResponseModel>>> Query
ISearchResults results;

// NativeQuery will work for a single word/phrase too (but depends on the implementation) the lucene one will work.
// Due to examine changes we need to supply the skipTakeMaxResults, see https://github.com/umbraco/Umbraco-CMS/issues/17920 for more info
try
{
results = searcher
.CreateQuery()
.NativeQuery(term)
.Execute(QueryOptions.SkipTake(skip, take));
.Execute(new LuceneQueryOptions(skip, take, skipTakeMaxResults: skip + take));
}
catch (ParseException)
{
Expand Down

0 comments on commit 0e06c47

Please sign in to comment.