Copied to clipboard

Flag this post as spam?

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


  • Lee 95 posts 115 karma points
    Nov 06, 2011 @ 14:17
    Lee
    0

    Using examine search

    Hi

    I have viewed all the Umbraco TV videos on the Examine search and still having problems with my search return.

    Basically I'm trying to exclude some nodes from the search, but when I perform the search ALL the nodes are returned that match the serach term.

    Here is my files:

    EXAMINEINDEX.CONFIG:

    <?xml version="1.0"?>
    <!--
    Umbraco examine is an extensible indexer and search engine.
    This configuration file can be extended to create your own index sets.
    Index/Search providers can be defined in the UmbracoSettings.config

    More information and documentation can be found on CodePlex: http://umbracoexamine.codeplex.com
    -->
    <ExamineLuceneIndexSets>
        <!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
        <IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/">
          <IndexAttributeFields>
             <add Name="id" />
            <add Name="nodeName" />
            <add Name="updateDate" />
            <add Name="writerName" />
            <add Name="path" />
            <add Name="nodeTypeAlias" />
            <add Name="parentID" />
          </IndexAttributeFields>
          <IndexUserFields />
          <IncludeNodeTypes>
        <add Name="FAQ" />
        </IncludeNodeTypes>
          <ExcludeNodeTypes>
        <add Name="Image" />
        </ExcludeNodeTypes>
        </IndexSet>
     
        <!-- 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>
            <IndexUserFields/>
            <IncludeNodeTypes><add Name="Image" /></IncludeNodeTypes>
            <ExcludeNodeTypes/>
        </IndexSet>
       
        <IndexSet SetName="MySiteIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/MySite/">
                <IndexAttributeFields>
                <add Name="nodeTypeAlias" />
            </IndexAttributeFields>
            <IndexUserFields>
            <add Name="bodyText" />
            <add Name="staffTitle" />
          </IndexUserFields>
          <IncludeNodeTypes>
            <add Name="Page" />
            <add Name="RecipeContainer" />
            <add Name="Recipe" />
            <add Name="uBlogsyPost" />
          </IncludeNodeTypes>
          <ExcludeNodeTypes>
            <add Name="ExternalLink" />
            <add Name="Frontpage" />
            <add Name="Lang" />
            <add Name="MainMaster" />
            <add Name="Error404" />
            <add Name="Sitemap" />
            <add Name="Image" />
          </ExcludeNodeTypes>
        </IndexSet>
    </ExamineLuceneIndexSets>

     

    EXAMINESETTINGS.CONFIG

    <?xml version="1.0"?>
    <!--
    Umbraco examine is an extensible indexer and search engine.
    This configuration file can be extended to add your own search/index providers.
    Index sets can be defined in the ExamineIndex.config if you're using the standard provider model.

    More information and documentation can be found on CodePlex: http://umbracoexamine.codeplex.com
    -->
    <Examine>
      <ExamineIndexProviders>
        <providers>
          <add name="InternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
               supportUnpublished="true"
               supportProtected="true"
               interval="10"
               analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>

          <add name="InternalMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
               supportUnpublished="true"
               supportProtected="true"
               interval="10"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
           
            <add name="MySiteIndexer"
                 type="UmbracoExamine.LuceneExamineIndexer, UmbracoExamine"
                 analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>

        </providers>
      </ExamineIndexProviders>

      <ExamineSearchProviders defaultProvider="InternalSearcher">
        <providers>
          <add name="InternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
               analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>

          <add name="InternalMemberSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcards="true"/>
           
            <add name="MySiteSearcher"
                 type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"/>
        </providers>
      </ExamineSearchProviders>

    </Examine>

     

    Could anyone help please?

     

    Thanks

  • Owen 123 posts 246 karma points
    Nov 06, 2011 @ 14:23
    Owen
    0

    I think the problem is how do you performance a search, not how do you index the data.

    So if you can post the code you used, that would be better.

  • Lee 95 posts 115 karma points
    Nov 06, 2011 @ 16:51
    Lee
    0

    Do you mean this bit?

     

    @using Examine;

    @* Get the search term from query string *@
    @{var searchTerm = Request.QueryString["search"];}
    @{var results = ExamineManager.Instance.Search(searchTerm, true); }

    @{if (results.TotalItemCount == 0)
      {
        <p>No results found</p>
      }
      else
      {
        <ul class="search-results">
            @foreach (var result in results)
            {                                                                   
                <li>
                    @result.Fields["nodeTypeAlias"]
                    <a href="@umbraco.library.NiceUrl(result.Id)">
                        @result.Fields["nodeName"]
                    </a>       
                </li>
       
            }
            </ul>
        }
    }


  • Mysterious 27 posts 47 karma points
    Dec 04, 2011 @ 02:31
    Mysterious
    0

    Hello Lee,

    I faced the same problem with no luck, but here is a workaround (in my case I only want to return result of document type "Photo")

    @{
    var allresults = ExamineManager.Instance.Search(searchTerm, true);
    var results = allresults.Where(a => a.Fields["nodeTypeAlias"] == "umbGalleryPhoto");
    }

    I wish there is some solution for this issue

  • MK 429 posts 905 karma points
    Mar 14, 2012 @ 08:09
    MK
    0

    Hi all,

    Just add the SearchProviderCollection name you defined in the ExamineSetting.config as bellow and you are good to go. 

     

     

      var results = ExamineManager.Instance.SearchProviderCollection["YourSearchProvider"].Search(searchTerm, true);
      

     

    Regards,

    mkariti

Please Sign in or register to post replies

Write your reply to:

Draft