You probably need to either exclude a specific NodeTypeAlias from the Examine results or add a property to one or more document types you want to exclude from the results.
I just haven't rebuilt the indexes yet as I wasn't sure if there is another approach.
Would excluding the node type by name stop Examine returning the page where the node is added? Or would it just exclude the node from the search results?
And in your opinion is the above the best approach?
Okay, you have this part to find get node based on a selected template.
//Check if node found has a parent redirect template. If it does we want to find the first parent page.
if (node.GetTemplateAlias() == "USNParentRedirect")
{
node = node.Ancestors().First(x => x.GetTemplateAlias() != "USNParentRedirect");
}
Also note the Search() method y default only return 500 results. You can increase that e.g. Search(examineQuery.Compile(), maxResults: 1000) but not recommended to increase it too much. If the project has a lot of content nodes it probably need to return a paged result instead.
Examine linking direct to a node
Hi all
We recently released a new component type on our website.
It has been spotted that within the Examine search results there is a link directly into the component as well as the page it is on.
What would be the best approach to exclude the direct link into the component from the search results?
Here is the link that is showing:
/need-help/prohibited-goods/components/item-list/
Thank you all in advance Ben
Hi Ben
You probably need to either exclude a specific NodeTypeAlias from the Examine results or add a property to one or more document types you want to exclude from the results.
Hi Bjarne
Thank you for taking the time out to reply.
I had already kinda gone down the route of adding the below to the ExamineIndex.config file
I just haven't rebuilt the indexes yet as I wasn't sure if there is another approach.
Would excluding the node type by name stop Examine returning the page where the node is added? Or would it just exclude the node from the search results?
And in your opinion is the above the best approach?
Thanks Ben
Ahh, I didn't notice it was related to v7, where you have to config files.
You should be able to exclude the document type by it's alias, but I think the name shouldn't include a space.
If have another node selecting this node type using a picker, I guess it returns a value for the specific property.
Do you have a code snippet of the Examine quering and how the results are returned?
Hi Bjarne
Just to clarify, are you referring to the code snippet that writes out the results in the view?
Hi Ben
Yes, or in a Controller. Mainly the part doing the Examine query and maybe share to node structure in Umbraco :)
Hey Bjarne
Here's the code from the partial view :-)
@inherits UmbracoViewPage
@using USNStarterKit.USNHelpers; @using Examine.SearchCriteria; @using Examine.LuceneEngine.SearchCriteria; @using Umbraco.Web; @using UmbracoExamine; @using Our.Umbraco.Vorto.Extensions; @using System.Text.RegularExpressions; @using System.Threading
@{ UsnglobalSettings globalSettings = (UsnglobalSettings)Model.GlobalSettings; var currentCulture = Thread.CurrentThread.CurrentCulture.ToString();
}
Hi Ben
Okay, you have this part to find get node based on a selected template.
Not sure what the specific purpose of this is. I would probably use Content Picker, MNTP (configurated as single picker - max = 1) or Multi URL Picker https://our.umbraco.com/packages/backoffice-extensions/multi-url-picker/ (this is include in Umbraco core in newer versions of Umbraco).
Then you would be able to select exact node to redirect to
It is worth mentioning that you could use Content Picker and alias
umbracoRedirect
which would automatically handle a redirect when accessing that node. https://our.umbraco.com/Documentation/Reference/Routing/routing-properties#umbracoredirectYou could also consider call the
ConvertSearchResultToPublishedContent
extension method.which would return the Examine results as
IEnumerable<IPublishedContent>
.It should then also be possible to filter the collection on
umbracoNaviHide
using.IsVisible()
extension.However it would be better to include this as part of you Examine query (filter/exclude as much as possible here), which you actually do here:
But since you have the second lookup, you probably need it again. Some of these approaches should work as well.
Also note the
Search()
method y default only return 500 results. You can increase that e.g.Search(examineQuery.Compile(), maxResults: 1000)
but not recommended to increase it too much. If the project has a lot of content nodes it probably need to return a paged result instead.Hi Bjarne
Sorry for the late reply, so great stuff in there and I will take a look over to see what options I can utilise.
Thanks again
is working on a reply...