Hi all. I have a news site based on umbraco 8.11.1 with Examine v1.0.6 and i am using the following code in order to query articles.
// Get the external index with error checking
//-------------------------------------------
if (!_examineManager.TryGetIndex(UmbracoIndexes.ExternalIndexName, out IIndex index))
{
throw new InvalidOperationException($"No index found by name {UmbracoIndexes.ExternalIndexName}");
}
try
{
var searcher = index.GetSearcher();
var criteria = searcher.CreateQuery(IndexTypes.Content);
// Search Code to use with the ExternalIndex
// -----------------------------------------
var examineQuery = criteria.Field("__NodeTypeAlias", "newsArticle");
if (model.ParentId.HasValue)
examineQuery.And().ParentId(model.ParentId.Value);
examineQuery.OrderByDescending(new SortableField[] { new SortableField("articleUpdateDate", SortType.Long), new SortableField("__NodeId", SortType.Int) });
The value of the examine query is
+__NodeTypeAlias:newsarticle
if the parentID varialble does not have value and
+__NodeTypeAlias:newsarticle +(parentID:[1063 TO 1063])
if the parentID variable has a value.
The results are great and works as expected.
After upgrading umbraco to 8.14.0 which upgrades the Examine library to 1.2.0 unfortunately i am not getting any results. If a use the umbraco backend examine search interface i am getting results but from the code behind i am not getting anything.
Examine v1.2.1 query problem
Hi all. I have a news site based on umbraco 8.11.1 with Examine v1.0.6 and i am using the following code in order to query articles.
The value of the examine query is
+__NodeTypeAlias:newsarticle
if the parentID varialble does not have value and
+__NodeTypeAlias:newsarticle +(parentID:[1063 TO 1063])
if the parentID variable has a value.
The results are great and works as expected.
After upgrading umbraco to 8.14.0 which upgrades the Examine library to 1.2.0 unfortunately i am not getting any results. If a use the umbraco backend examine search interface i am getting results but from the code behind i am not getting anything.
Any help please?
Well after a lot of debugging on the following code
i found that i am getting value for the searchResult.TotalItemCount but i am not getting Results. Using Examine 1.0.6 i was getting the Results also.
is working on a reply...