as i see your code is for sorting by date
my case is that i have a huge number of nodes and i don't want examine to return them all at once i want to be able to chose that i want to return 4 results for example and identify witch 4 like first 4 result or second 4 result and so on.
here is my code
if (ExamineManager.Instance.TryGetIndex("InternalIndex", out var index))
{
var mainSettings = Umbraco.Content(2564);
var searcher = index.GetSearcher();
ISearchResults ExamineResults = null;
var query = searcher.CreateQuery("content");
IBooleanOperation queryOperations = query.Field("__NodeTypeAlias", "newsItem");
if (CategoryPath != "")
{
//CategoryPath = Umbraco.Content(2626).Path;
queryOperations = queryOperations.And().Field("path", CategoryPath.MultipleCharacterWildcard());
}
if (Keyword != "")
{
queryOperations = queryOperations.And().Field("newsTitle", Keyword);
}
if (Year != "")
{
int mon = Month.IsNullOrWhiteSpace() ? 1 : Convert.ToInt32(Month);
queryOperations= queryOperations.And().RangeQuery<DateTime>("publish_time".Split(','),new DateTime(Convert.ToInt32(Year), mon, 1),new DateTime(Convert.ToInt32(Year), mon, 31));
}
ExamineResults=queryOperations.OrderByDescending(new SortableField[] { new SortableField("publish_time") }).Execute();
}
this search should return more than 500 node so i will waste the time if i make query get all of the node to display just 4 nodes every time
any advice ?
How to pagination with examine umbraco 8 ?
Hi
is there any way to identify the number of results that i want returned by examine like skip but before executing the whole query ?
This may help ? Assume you have a publishedDate field for sorting. Update it as required.
ISearchResults has total count. (TotalItemCount)
Hi S Rupa
as i see your code is for sorting by date my case is that i have a huge number of nodes and i don't want examine to return them all at once i want to be able to chose that i want to return 4 results for example and identify witch 4 like first 4 result or second 4 result and so on.
here is my code
this search should return more than 500 node so i will waste the time if i make query get all of the node to display just 4 nodes every time any advice ?
Hi,
The execute method takes a maxResults parameter which specifies the number of results to return. The default value is 500.
is working on a reply...