Copied to clipboard

Flag this post as spam?

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


  • Corné Strijkert 61 posts 398 karma points
    Mar 04, 2019 @ 20:23
    Corné Strijkert
    0

    Where are the Examine config files located in v8?

    Hi,

    Does anyone know where the ExamineIndex.config and ExamineSettings.config are located in Umbraco 8? I can't find this files.

    Also the Examine Management tab only lists the Indexers. The configured (or not?) searchers aren't listed.

  • Damiaan 427 posts 1269 karma points MVP c-trib
    Mar 04, 2019 @ 21:13
    Damiaan
    0

    I thought examine is now configured in code. The documentation is not yet done as you can see here: https://our.umbraco.com/Documentation/v8documentation

    I would look for components with examine in the name in the source code for now.

  • Louis Jackson-Rees 91 posts 318 karma points c-trib
    Mar 05, 2019 @ 08:00
  • Michael Argentini 9 posts 100 karma points
    Mar 09, 2019 @ 18:39
    Michael Argentini
    1

    I had the same question. But for the time being, I used the default configured external indexes. In my Umbraco 8 test project, this partial snippet is used for searching content of document type "Quotation":

    // q = search string from an input field
    // Break search into separate terms
    // You should check for null or empty string
    
    var _searchTerms = q.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    
    // I use a loop here so I can optionally remove noise words and such...
    foreach (var term in _searchTerms)
    {
        searchTerms.Add(term);
    }
    
    if (searchTerms.Length > 0)
    {
        if (!ExamineManager.Instance.TryGetIndex("ExternalIndex", out var index) || !(index is IUmbracoIndex umbIndex))
        { 
            throw new InvalidOperationException($"No index found by name ExternalIndex or is not of type {typeof(IUmbracoIndex)}");
        }
    
        var searcher = umbIndex.GetSearcher();
    
        if (searcher != null)
        {
            var qry = searcher.CreateQuery("", BooleanOperation.And)
                .Field("__NodeTypeAlias", "quotation");
    
            foreach (var term in searchTerms)
            {
                qry = qry.Or().Field("quote", term);
            }
    
            var results = qry.Execute(10);
    
            if (results != null && results.Count() > 0)
            {
                // Process results
            }
        }
    }
    

    Hope this helps while they rework the documentation ;)

  • mcgrph 20 posts 135 karma points
    27 days ago
    mcgrph
    1

    This was pretty much what I was looking for. I was failing with TryGetSearcher because there was none, but the way with the index solved it for me!

  • Craig Cronin 299 posts 498 karma points
    1 week ago
    Craig Cronin
    0

    Do you know how to search multiple document types? e.g quotation and others?

  • Michael Argentini 9 posts 100 karma points
    1 week ago
    Michael Argentini
    0

    In my example, try adding query criteria like:

    qry = qry.Or().Field("__NodeTypeAlias", "docTypeAliasHere");
    
Please Sign in or register to post replies

Write your reply to:

Draft