I see i forgot to add some code when creating the example. The init function needs some code to bind the onIndexTransform event:
if (websiteIndex is BaseIndexProvider baseIndex)
{
baseIndex.TransformingIndexValues += OnIndexTransform;
}
So you need to update the initialize function to something like this:
public void Initialize()
{
if (_examineManager.TryGetIndex(Constants.UmbracoIndexes.ExternalIndexName, out IIndex websiteIndex))
{
websiteIndex.FieldDefinitionCollection.AddOrUpdate(new FieldDefinition("productBrand_parsed", FieldDefinitionTypes.FullText));
if (websiteIndex is BaseIndexProvider baseIndex)
{
baseIndex.TransformingIndexValues += OnIndexTransform;
}
}
}
Exmaine a field containing Multinode tree content
Using Umbraco8
I have to field on my product listing 1. Multinode tree of Brands "productBrand" 2. Multinode tree of Categories "productCategory"
I are using Examine "ExternalIndexes" to get a list of all the products and this is working.
But how do I get a list filtered by my 2 Multinode trees.
I can pass the field name thats easy, but what do I do for the criteria
Hi Daniel,
You can add a custom field to the index with the parsed names or id's of your selected multinode tree picker items. Something like this:
After this your index has a new field called: productBrand_parsed. You can search in this field with the name of the brand.
You can find more information about custimizing the index here:
https://our.umbraco.com/documentation/reference/searching/Examine/indexing/
Thanks Erik for the help.
Im getting there.
I have got to the point of registering the indexer and initializing it with 4 new fields.
However they dont appear in the backoffice if I do a manual examine. But that might be related to my next points.
What is the purpose of this line
_websiteIndexCreator = websiteIndexCreator;
what triggers OnIndexTransform function as if I break point here the code never breaks.
Hi Daniel,
I see i forgot to add some code when creating the example. The init function needs some code to bind the onIndexTransform event:
So you need to update the initialize function to something like this:
You can remove the part with:
Thanks Erik for the help.
Im getting there.
I have got to the point of registering the indexer and initializing it with 4 new fields.
However they dont appear in the backoffice if I do a manual examine. But that might be related to my next points.
What is the purpose of this line
_websiteIndexCreator = websiteIndexCreator;
what triggers OnIndexTransform function as if I break point here the code never breaks.
Thanks Erik for you help.
With a few changes I have got it going.
needed to add
before
to register the composer
changed to
didn't like .Select
on side not are you able to give me some insite to this issue as well
https://our.umbraco.com/forum/using-umbraco-and-getting-started/107288-examine-get-exact-doc-type
Sorry Erik I marked the wrong post as the solution. Your too answers are the solution.
is working on a reply...