Copied to clipboard

Flag this post as spam?

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


  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 14, 2017 @ 13:30
    Dirk De Grave
    0

    Adding custom data into "default" umbraco index sets

    Hi,

    I was wondering if it would be possible to index non umbraco custom data into existing default index sets?

    Example: Fetch a record from a custom sql table, EntityA and index as if it were a node

    More or less something like this:

    var simpleDataSet = new SimpleDataSet { NodeDefinition = new IndexedNode { NodeId = 1234, Type = "EntityAType"}, RowData = new Dictionary<string, string>() { { "myField", "myValue" } } };
    ExamineManager.Instance.ReIndexNode(simpleDataSet.RowData.ToExamineXml(1234, "EntityAType"), "EntityAType");
    

    So, this custom record would need to end up in the Internal index, as with standard content and media

    Config slight change (from what I can read online) on the ExamineIndexProviders/providers section for the InternalIndexer

    indexTypes="Content,Media,MpoMeeting"
    

    Q1: Possible (Can't make it working atm, but could a config issue as well)

    Q2: Yay or nay?

    Regards, --Dirk

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Jun 14, 2017 @ 13:45
    Ismail Mayat
    0

    Dirk,

    I guess in theory you could get it to work issue is why are trying todo this?

    So one issue may be on rebuild you click it and internal index rebuilds but what about the data from this other data source?

    Are you doing this because you want to search over 2 indexes? Or you have this related data in third party data source that needs to be part of the umbraco node but only for search? If its the former then you can do multiindex search if its the latter then i would have save action on node and then using webservice or the like that the related data and inject that in as a field.

    Regards

    Ismail

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Jun 14, 2017 @ 13:47
    Dave Woestenborghs
    0

    Hi Dirk,

    Maybe not entirely what you are looking for but Richard Soetemann created a package to store data from database in to a examine index.

    https://soetemansoftware.nl/blog/examine-db

    Dave

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 14, 2017 @ 13:55
    Dirk De Grave
    0

    Exactly, not relevant in our case, I know how to create custom indexes based on your custom data... it's the single source search i'm after

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 14, 2017 @ 13:50
    Dirk De Grave
    0

    Hi Ismail,

    Basic idea is trying to avoid to query multiple sources (need to fetch AType and BType kind of records, where AType is stored in sql custom table, BType is umbraco doc type kind), so if I could insert the AType records as if they were umbraco docs I wouldn't have the need to search sql (source 1) and umbraco index (source 2) to fetch all data (Makes pagination based on custom properties rather complex), but only the umbraco index

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 14, 2017 @ 13:51
    Dirk De Grave
    0

    But your multi-index search is triggering my attention, anything I can lookup online in docs?

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Jun 14, 2017 @ 14:05
    Ismail Mayat
    1

    Dirk,

    You need multi index search its v easy. So maybe use Richards package to give you the second index. Then you create new searcher (btw this is all covered on the examine course lol) in the ExamineSettings config file eg:

    <add name="ExternalSearcher"
    

    type="Examine.LuceneEngine.Providers.MultiIndexSearcher, Examine" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcards="true" indexSets="ExternalIndexSet,PDFIndexSet" />

    Obviously replace indexSets value with names of your index sets.

    Then in your code:

    BaseSearchProvider _searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
    

    And build up your query and off you go. Btw how come you are searching on internal do you have to search on unpublished content?

    Regards

    Ismail

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 14, 2017 @ 14:12
    Dirk De Grave
    0

    Ah cool, one day I'll make it to the course ;-) Multi-index search seems a good solution!

    About the search in internal > yes, makes sense in our environment to sometimes also search for content not yet published (without going into too much tech details, it involves some complex data validation)

    Anyway, whether it were published or non published content, you're multi index solution seems a good candidate!

    Huge thanks for the help!

    --Dirk

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Jun 14, 2017 @ 15:04
    Ismail Mayat
    0

    Dirk,

    One thing to note with the custom index. When you have custom indexer you have ability to do full rebuild only so if that db data changes you will need a way to update. If the data is not changing very often then you could have scheduled job which rebuilds the index say once a night.

    However if you need instant updates then you will need to look at some kind of trigger to notify a change has happened on a record on the db then you can index just that one row. For umbraco indexes you do not have this worry as we have events that fire that examine listens to.

    Regards

    Ismail

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 16, 2017 @ 06:45
    Dirk De Grave
    0

    I never replied on your last comment (shame on me!)... I will now!

    Don't need immediate updates as data is being pushed from Oracel to sql db 1x/day, so we can schedule this import/publish/index routine easily.

    So, no triggers involved, except for triggering the import!

    Good feedback though, may help others struggling to get this up and running!

    Cheers and super tak! for your help!

    --Dirk

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Jun 16, 2017 @ 08:03
    Ismail Mayat
    0

    Dirk,

    Cool, the only other thing is you may need to fiddle with your query a bit so that you end up searching on both indexes because you will have umbraco content with all its fields including core properties which you may or may not search on and the db properties which will no doubt be different.

    Dont forget to mark solution ;-}

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 16, 2017 @ 08:07
    Dirk De Grave
    0

    Fair point, I need to mark your suggestions as solution, I was probably waiting for the friendly our bot to remind me ;-)

    Our search query isn't too complex and doesn't involve any of the standard props, so we're covered in that area.

    Bit too far off topic to go into the tech details of the solution, we'll have a chat one day on the why of all this...

    Again, #h5yr

    --Dirk

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 16, 2017 @ 08:08
    Dirk De Grave
    0

    Karma sent your way!

Please Sign in or register to post replies

Write your reply to:

Draft