Copied to clipboard

Flag this post as spam?

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


  • Thomas 319 posts 606 karma points c-trib
    Sep 21, 2020 @ 11:54
    Thomas
    0

    Umbraco Searcher with Muli searcher

    Hey

    I have som trouble with my Searcher.

    I have two ways here to get a result.

    Version 1. Gives me the correct result.

    Version 2, haves trouble with searching for stuff with danish letters (æøå).

    Is there a way to use thosse restrictions I have on version 2 on version 1 ?

    What fields it should search through, what doctypes, boost som fields etc. ??

     if (!ExamineManager.Instance.TryGetSearcher("MultiSearcher", out var searcher))
            {
                throw new InvalidOperationException($"No index found with name MultiSearcher");
            }
    
            //var word = SearchFriendlyString(searchTerm);
    
    
    
            //Version 1
            var results = searcher.Search(WebUtility.HtmlDecode(searchTerm), 500);
    
    
            //Version 2 
            IQuery query = searcher.CreateQuery(null);
            var textFields = "caption,altText,title_" + Lang + ",description_" + Lang +",content_" + Lang +",pDFDescription,__NodeTypeAlias,nodeName_" + Lang + ",nodeName,fileTextContent,sidebarContent_" + Lang;
            IBooleanOperation terms = query.GroupedOr(textFields.Split(','), searchTerm);
            string pageExclusionFields = "umbracoNaviHide";
    
            terms = terms.Not().GroupedOr(pageExclusionFields.Split(','), 1.ToString());
            terms = terms.Not().Field("__IndexType", "media");
            terms = terms.And().GroupedOr(new[] { "__NodeTypeAlias" }, new[] { "File","articlePage", "ritzauArticle", "sectionPage", "pageCampaignArticlePage", "pageCampaignSection" });
            var antoherResult = terms.Execute();
    
    
            return results;
    
  • Simon Ulmbrant 34 posts 154 karma points
    Sep 21, 2020 @ 20:12
    Simon Ulmbrant
    0

    I had a similar issue but with swedish characters ääö. If I remember it correctly the problem wasn't about the MultiSearch for me though. I think it hade something to do with wildcard searching. The solution for me was a little dirty but solved the problem. I replaced the åäö with aao in the search term and it solved the problem and gave me results with åäö. Maybe it could help you in some way

Please Sign in or register to post replies

Write your reply to:

Draft