Copied to clipboard

Flag this post as spam?

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


  • Thomas 315 posts 602 karma points c-trib
    Feb 18, 2022 @ 08:13
    Thomas
    0

    In Umbraco 8 I could add searcher like this:

    if (_examineManager.TryGetIndex(Constants.UmbracoIndexes.ExternalIndexName, out var externalIndex) && _examineManager.TryGetIndex(Constants.UmbracoIndexes.InternalIndexName, out var internalIndex) && _examineManager.TryGetIndex(PdfIndexConstants.PdfIndexName, out var pdfIndex) && _examineManager.TryGetIndex("IntranetUserIndex", out var intranetMemberIndex))
            {
                var multiSearcher = new MultiIndexSearcher("PDFMultiSearcher", new IIndex[] { externalIndex, pdfIndex, intranetMemberIndex });
                _examineManager.AddSearcher(multiSearcher);
    
                if (!(internalIndex is LuceneIndex Iindex))
                    throw new InvalidOperationException("Could not cast");
                Iindex.TransformingIndexValues += InternalIndexProviderTransformingIndexValues;
            }
    

    In Umbraco 9 _examineManager don't contain AddSearcher ?

    Anyone that can help ?

  • Alex 4 posts 127 karma points
    Mar 04, 2022 @ 11:34
    Alex
    100

    Hi Thomas,

    some things have changed in U9. It seems the ExamineManager Interface no longer provides methods for adding searchers and indexes.

    Instead you can register them, as well as a multisearcher, as a service in your service collection. If you do that in your startup class you can do something like:

    services.AddExamineLuceneMultiSearcher("MultiSearcherContentPdf",
    new[] { PdfIndexConstants.PdfIndexName, Constants.UmbracoIndexes.ExternalIndexName });
    

    You just need to specifiy the names of your indexes that should be part of the multisearcher.

    It also seems that the nuget package UmbracoCms.UmbracoExamine.PDF is not yet ready for U9 and .NET 6, so I used this one Umbraco.ExaminePDF

    So all you need to do is install the nuget package, register your multisearcher in your code and it will appear in Umbracos Examine Management Tab.

    Hope that helps.

  • Thomas 315 posts 602 karma points c-trib
    Mar 07, 2022 @ 09:09
    Thomas
    1

    Thanks Alex ! :) Worked

Please Sign in or register to post replies

Write your reply to:

Draft