Copied to clipboard

Flag this post as spam?

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


  • Frank Thode 8 posts 38 karma points
    Jun 17, 2015 @ 19:36
    Frank Thode
    0

    Examine index configuration - any ideas ?

    I am fairly new to Umbraco, and I am trying to implement a sidewide search feature for our homepage with the Use of Examine.

    I am using a out of the box Examine configuration (which should index all content, according to "Examine Examine..." article) - but my serach results are strange. I gather it must be the indexing that is off, but I don't know how to enhance it.

    For instance - when I search for "nyheder" (news in Danish), I get two results, which points to blank pages.

    And I do not get our actual news page in the results, which has a <h3>Nyheder</h3> tag - and a lot of other text with "nyheder" in it.

    Does anyone have a hint to how I set up the ExamineIndex.config file for a full text search for all external pages for the site ?? Getting pretty frustrated with this package !

    PS: I have tried installing Full Text Search from Codeplex, but this gives me even fewer search results out of the box

    Hope someone can get me further on this .Frank Frank

  • Rik Helsen 670 posts 873 karma points
    Jun 18, 2015 @ 07:28
    Rik Helsen
    0

    It sounds like the field you have entered this content in is not included in your index?

  • Chris Wilson 100 posts 377 karma points
    Jun 18, 2015 @ 07:57
    Chris Wilson
    0

    I have experienced something similar to this previously; essentially the index was out of date and the index nodes were pointing at old content node IDs.

    Have you rebuilt your index from the Developer > Examine Management section?

    Also I assume you are using the standard ExamineIndex.config configuration for the External Indexer - could you paste it here for us please along with the code you're using to initiate the search?

  • Frank Thode 8 posts 38 karma points
    Jun 18, 2015 @ 11:55
    Frank Thode
    0

    Hi and Thanks for your replies.

    Tried rebuild of index - same search results afterwards :O(

    I really don't do much out of the ordinary in my code, but please feel free to comment - or maybe if you have experinece with setup of the Full Text Search package instead:

    This is my index setup from ExamineIndex.config:

      <!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
      <IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/" />
      <!-- The internal index set used by Umbraco back-office for indexing members - DO NOT REMOVE -->
      <IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/InternalMember/">
        <IndexAttributeFields>
          <add Name="id" />
          <add Name="nodeName" />
          <add Name="updateDate" />
          <add Name="writerName" />
          <add Name="loginName" />
          <add Name="email" />
          <add Name="nodeTypeAlias" />
        </IndexAttributeFields>
      </IndexSet>
      <!-- Default Indexset for external searches, this indexes all fields on all types of nodes-->
      <IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/" />
    

    This is the form that I post to my search result page via GET:

    <form class="navbar-form hidden-xs hidden-sm hidden-lg searchForm" role="search" style="margin-left: 620px;">
                                <div class="input-group">
                                    <input type="text" class="form-control searchFormControl" placeholder="søg" name="q" style="margin-left:80px; width:150px;">
                                    <div class="input-group-btn">
                                        <button class="btn btn-default searchFormButton" type="submit" formaction="/vis-soegeresultater/" formmethod="get"><i class="glyphicon glyphicon-search"></i></button>
                                    </div>
                                </div>
                            </form>
    

    This is the markup in my search result page - ideas of alternatives much appreciated:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = "Master.cshtml";
    }
    @{
        IEnumerable<IPublishedContent> results = null;
        if (!string.IsNullOrEmpty(Request.QueryString["q"]))
        { 
            results = Umbraco.TypedSearch(Request.QueryString["q"]);
        }
        var resultText = results.Count() == 1 ? "resultat" : "resultater";
    }
    <div class="container">
        <div class="row">
            <div class="col-xs-12">
                <h1>Vi fandt @results.Count() @resultText for søgningen <em>@Request.QueryString["q"]</em></h1>
                <br />
                @if (results != null)
                {
                    <ul>
                        @{
                            var contentText = "";
                        }
                        @foreach (var result in results)
                        {
                            <li>
                                <a href="@result.Url()">@result.Name</a> - @result.CreateDate.ToShortDateString()
                                <br />
                                @{
                                    contentText = result.Properties.First().DataValue.ToString();
                                    contentText = System.Text.RegularExpressions.Regex.Replace(contentText, @"<[^>]+>|&nbsp;", "").Trim();
                                    contentText = System.Text.RegularExpressions.Regex.Replace(contentText, @"\s{2,}", " ");
                                }
                                <p>@Html.Raw(contentText.Length > 500 ? contentText.Substring(0, 500) + "..." : contentText.Substring(0, contentText.Length))</p>
                                <br/><br />
                            </li>
                        }
                    </ul>
                }
            </div>
        </div>
    </div>
    
  • Chris Wilson 100 posts 377 karma points
    Jun 18, 2015 @ 14:02
    Chris Wilson
    0
    • Your ExamineIndex should be indexing all fields, so that looks fine.

    • The form is just a textbox and submit button so that looks fine too.

    • The search logic is nice and simple and you're taking the count from the returned enumerable so that should be accurate.

    The next thing to do is to take a peek inside your Index and see what's there. You can in theory do that using Developer > Examine Management > Searchers > ExternalSearcher, however I have discovered that running this query can cause the page to stop responding if you have a large number of content nodes.

    What I recommend instead is using Luke, available here: Luke - Lucene Index Tooblbox

    Point this at the location of your indexes - usually:

    [Application Root]\App_Data\TEMP\ExamineIndexes\External\Index

    Then open up the 'Search' tab, set the following:

    • Analyzer = Lucene.Net.Analysis.SimpleAnalyzer
    • Default field = __IndexType
    • Search expression = content

    This will return all indexed nodes to you in a tabulated form, check that the nodes you expect to see are there and their 'content' node contains the search terms you expect.

    If you are sure the above is correct, you can switch the Default field to 'content' and try your searches again. If you are successful in returning nodes this way, we can look to implement a slightly more hands-on search mechanism in your original code.

    /Chris

  • Frank Thode 8 posts 38 karma points
    Jun 19, 2015 @ 09:23
    Frank Thode
    0

    Hi Chris

    Thanks very much for your input - I really appreciate it !

    Tried running Lucene, but it gives me this error

    I gather it is ver. 3.4 of Lucene I should use - version 4.0 also available won't load index at all.

    You write that I should use analyser: Lucene.Net.Analysis.SimpleAnalyzer. In my ExammineSettings.config I have this element:

    <add name="ExternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" enableLeadingWildCards="true" />
    
    • hence not statin any specifik analyser type to use for the External sarcher - should that be Lucene.Net.Analysis.SimpleAnalyzer then ??
  • Frank Thode 8 posts 38 karma points
    Jun 19, 2015 @ 11:41
    Frank Thode
    0

    Hi Chris

    I decided to go with the Full Text Searcher instead - it Rocks !

    The reason that it didn't get me results in the first place, was lack of indexing. From your suggestion to do indexing through the Examine Dashboard, I got the idea to try the same with the Full Text searcher (which also has a dashboard).

    After doing this, and adding two ignore tags for header and footer in the Full Text Search config file - I get much more results, and they seem accurate, and it runs fast, so I am happy - refer to same search phrase for "Nyheder" with the new seach engine

    Thanks for your support ;o)

    enter image description here

  • Chris Wilson 100 posts 377 karma points
    Jun 19, 2015 @ 11:43
    Chris Wilson
    0

    Sorry, I linked you to the Java version! I have more success with the .NET version:

    Luke.NET

    No, you don't need to worry about setting a specific analyser for ExternalSearcher in your config files, the default configuration should work just fine - this was purely to get some results coming out of Luke.

    You can have a little play around with the analysers, it's interesting to see how you can finetune your search with them. The Simple Analyser is merely the most straightforward.

  • Chris Wilson 100 posts 377 karma points
    Jun 19, 2015 @ 11:45
    Chris Wilson
    0

    Glad to hear you got it working in the end!

Please Sign in or register to post replies

Write your reply to:

Draft