Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jason Verschage 1 post 71 karma points
    Apr 27, 2022 @ 17:05
    Jason Verschage
    0

    Umbraco 9 Examine Index Creation/Modification from Nested Content?

    Greetings,

    I'm relatively new to Umbraco, so apologies if I mess something up in the explanation below.

    I've created a site whereby I have a Nested Collection of Year Elements, where each Year contains a Nested Collection of Rule Elements, and each of those Rules contains a nested collection of Document Elements. It's like Russian nesting dolls, but the users wanted a heirarichal setup for entry because it would make more sense to them.

    Those same end users, though, want to search for the media by the display text attached in the Document Element, instead of the filename. The JSON complexity leads me to believe that the best way for searching would be to just create an Examine Index of documents of the 4 properties plus the ID (Year, Rule, DisplayText, URL) and then just use that to find everything. However, where I'm getting confused is how to build said index.

    One option, it seemed to me, was use the ExternalIndex to get the GUID of the main Rules document type, then use ModelBuilder classes to obtain everything through looping through IEnumerables 3 times. However, I'm not sure how I would set that up in te Component/Composer Model, since adding a Lucene Index is done via UmbracoBuilder Services. It feels like I can modify the data of an outstanding index or create a new one, but not reference back to the data.
    (Based off https://github.com/Adolfi/UmbracoNineDemoSite/tree/70a0add43eb02ba15f454afadb0467ccd76eb899/UmbracoNineDemoSite.Core/Features/Search/Examine/Index)

    Another option would be to pull the elements since they are all the same type, but it appears the XPath lookup to find said elements has been removed in Umbraco 9. If this isn't the case, this might be best.

    Finally, I could copy/modify the media type of a File to create SiteFile, that would then be referencable via ExternalIndex as a type, but I'm not sure how that would affect entry.

    Any suggestions about which might be the best way to approach this?

Please Sign in or register to post replies

Write your reply to:

Draft