Hi
You need to add a searchable path to the examine index which essentially takes the path and replaces the commas with spaces. Here is a link to some documentation which has an example for you.
Just note that this won't work if you have more than 500 results as Execute() by default limit to 500 results and that the LINQ query is more expensive.
You can add a searchPath like this in Vendr demo store
Examine Search: How to query nodes of specific parent
Hi to all, I'm trying to find a way to search nodes of a specific parent.
I read the very helpful Shazwazza examine documentation and I think that I must search in the field "__Path" that have a specific Node Id.
In the documentation I found this code from which I think I could start
But after some tests, I still don't find the right solution.
Can anyone help me?
Thank you for the support
Adriano
Hi You need to add a searchable path to the examine index which essentially takes the path and replaces the commas with spaces. Here is a link to some documentation which has an example for you.
https://our.umbraco.com/documentation/reference/searching/examine/examine-events#adding-the-path-of-the-node-as-a-searchable-field-into-the-index
Paul
Hi...sorry for delay to answer.
I try some solutions, including that you suggest, but I resolved using this simple code:
Adriano
Just note that this won't work if you have more than 500 results as
Execute()
by default limit to 500 results and that the LINQ query is more expensive.You can add a
searchPath
like this in Vendr demo storehttps://github.com/vendrhub/vendr-demo-store/blob/a976c4eafefcd3e92acbc9d65d4c73b529746e36/src/Vendr.DemoStore/Composing/DemoStoreComponent.cs#L83-L86
and then search this field, something like the following:
/Bjarne
Hi Bjarne,
thank you for the support.
I added the search path field like Vendr demo store...but I already have the GroupedOr(textFields, searchTerm) in my query
How I must change the code to include your change?
Adriano
Hi. I tried to add a piece of your code but VS complains that there is no Add() method taking 2 arguments..
Hi Adriano
Based on your query before, you can filter the results as part of the Examine query something like the following:
To search path you may need to create a
searchPath
field: https://our.umbraco.com/documentation/reference/searching/examine/examine-events/Bjarne
Wonderful, I'll try next Monday ;-)
Thank you and have a good weekend
Adriano
Hi Bjarne,
I tried and all function properly.
Only for info...to work correctly I had to write the query like that:
Thank you again
Adriano
is working on a reply...