I find in the following code, where I'm trying to search with IQueryExecutor to get paging, that the resultCount is correct but the searchResults are 0.
The query performs correctly in Luke against the InternalIndex using the Standard Analyser. If I recode for an unmanaged query set (searchResults = umbIndex.Searcher.CreateQuery()........Excute()) then I can get a full list of results, just not paged.
var indexName = Constants.UmbracoIndexes.InternalIndexName;
// Get the index with error checking
if (!_examineManager.TryGetIndex(indexName, out var index) || !(index is IUmbracoIndex umbIndex))
{
throw new InvalidOperationException(
$"No index found by name {indexName} or is not of type {typeof(IUmbracoIndex)}");
}
var query = umbIndex.Searcher.CreateQuery(IndexTypes.Content);
var queryExecutor = query.ManagedQuery(searchTerm)
.And().NodeTypeAlias("ThreeColumnPage")
.And().Field("column2Content", searchTerm)
.Not().Field("umbracoNaviHide", 1.ToString())
.Not().Field("published", "n".ToString());
searchResults = _publishedContentQuery.Search(
queryExecutor,
skip,
pageSize,
out resultCount);
Resulting in this (missing links list)
(skip and pageSize are correct and has similar performance against the ExternalIndex ;) )
Is IQueryExecutor still useable in V10+ ?
I want to get paged resultsSets rather than pull all the results every time and page them every time for efficiency.
The workaround mentioned is to inject IPublishedSnapshotAccessor and use this:-
_publishedSnapshotAccessor.TryGetPublishedSnapshot(out var publishedSnapshot);
var queryResults = searchQuery.Execute(new QueryOptions(0, 12));
var totalResults = queryResults.TotalItemCount;
var publishedContentResults = queryResults.ToPublishedSearchResults(publishedSnapshot);
Paged search with IQueryExecutor problem
Umbraco V10.0.1
I find in the following code, where I'm trying to search with IQueryExecutor to get paging, that the resultCount is correct but the searchResults are 0.
The query performs correctly in Luke against the InternalIndex using the Standard Analyser. If I recode for an unmanaged query set (searchResults = umbIndex.Searcher.CreateQuery()........Excute()) then I can get a full list of results, just not paged.
Resulting in this (missing links list)
(skip and pageSize are correct and has similar performance against the ExternalIndex ;) )
Is IQueryExecutor still useable in V10+ ?
I want to get paged resultsSets rather than pull all the results every time and page them every time for efficiency.
Any advice would be appreciated.
IQueryExecutor in Examine 3.0 hasn't changed. You can see all Examine changes for that release here https://github.com/Shazwazza/Examine/compare/dev...release/3.0
So perhaps its a change within Umbraco for v10, not sure.
Turns out you were right......
https://github.com/umbraco/Umbraco-CMS/issues/12551
The workaround mentioned is to inject IPublishedSnapshotAccessor and use this:-
is working on a reply...