Copied to clipboard

Flag this post as spam?

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


  • Darshit 7 posts 50 karma points
    Dec 21, 2012 @ 07:28
    Darshit
    0

    Razor search issue

    Hi I am using umbraco for CMS development.

     

    using for search Search_Results.cshtml using this file with  ExamineSnippets changes in web.config. Also have put search bar on header which is in master template. So for same in master template have add this code for search. But eavery time I am getting Please use the search box .  as I am using given razor file in video .syntext   var searchTerm = Request.Form["searchTerm"];
     if (searchTerm == null)
        {...

     

    My working web url is http://maceit.visa4u.in

     

    Please help me asap to get result

    <form action="/Search.aspx" method="GET">
        <div class="top-search">
            <input type="text" id="searchTerm" name="searchTerm" class="search-input"/>
            <!--<input name="search" class="search-input"  type="text" id="searchText" />-->
            <input type="submit" class="search-btn" value="">
         </div>
    </form>
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 26, 2012 @ 16:20
    Jan Skovgaard
    0

    Hi Darshit and welcome to our :)

    I think it's because you're using "GET" in the form in combination with "Request.Form". Try using Request.Querystring instead - This should give you the entered value.

    Hope this helps.

    /Jan

  • Darshit 7 posts 50 karma points
    Dec 28, 2012 @ 13:06
    Darshit
    0

    Hi Jan,

     



    Thanks for your kind support. I got your point. I have changed to querystring and I can move ahead from it. But now I am getting again error on

    var searcher = ExamineManager.Instance.SearchProviderCollection["RazorSiteSearcher"];

    As I am passed from if condition checking and now once I will be here with my debugg point and getting an error like "Error loading MacroEngine script (file: SearchResults.cshtml) " . In examine config I have made changes. Though Here I am sharing my both configs here. Please help me in this whats going wrong.

    I am hearty thankful to you if you could help me in this.

     

    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"/>

            <!-- default external indexer, which excludes protected and published pages-->
            <add name="ExternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
                supportUnpublished="false"
                supportProtected="false"
                interval="10"
                analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>

          <add name="FullTextIndexer" type="FullTextSearch.Providers.FullTextContentIndexer, FullTextSearch"
              runAsync="true"
                supportUnpublished="false"
                supportProtected="false"
                interval="10"
              analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
                enableDefaultEventHandler="true"
                indexSet="FullTextIndexSet"/>


          <add name="FullTextSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
                analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
                indexSet="FullTextIndexSet"/>

    <add name="RazorSiteIndexer"
                 type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
                 analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>

        </providers>
      </ExamineIndexProviders>

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

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

    <add name="RazorSiteSearcher"
                 type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"/>

        </providers>
      </ExamineSearchProviders>

    </Examine>

     

     

    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/>
        <ExcludeNodeTypes />
      </IndexSet>
    <IndexSet SetName="RazorSiteIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/RazorSite/" />
      <!-- 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/>
        <ExcludeNodeTypes />
      </IndexSet>


      <IndexSet SetName="FullTextIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/FullText/">
        <IndexAttributeFields>
          <add Name="id" />
          <add Name="nodeName"/>
          <add Name="nodeTypeAlias"/>
        </IndexAttributeFields>
        <IndexUserFields>
          <add Name="bodyText" />
        </IndexUserFields>
        <IncludeNodeTypes/>
        <ExcludeNodeTypes />
      </IndexSet>
       
      <!-- Default Indexset for external searches, this indexes all fields on all types of nodes-->
      <IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/" />
    </ExamineLuceneIndexSets>

    My Remain code in cshtml is ::

     

    var searcher = ExamineManager.Instance.SearchProviderCollection["RazorSiteSearcher"];
        var searchCriteria = searcher.CreateSearchCriteria(BooleanOperation.Or);
       
        var query = searchCriteria.GroupedOr(new string[] { "nodeName", "bodyText" }, searchTerm).Compile();
        var searchResults   = searcher.Search(query);
        var noResults       = searchResults.Count();
       
        <p>You searched for @searchTerm, and found @noResults results</p>
       
        <ul class="search-results">
            @foreach (var result in searchResults)
            {
                <li>
                    <a href="@umbraco.library.NiceUrl(result.Id)">@result.Fields["nodeName"]</a>
                </li>
            }
        </ul>

     

    I am hoping Best help from your side as you always helping me... :)

     

     

    --Darshit Panyda

    (+91999884917)

  • Darshit 7 posts 50 karma points
    Jan 08, 2013 @ 08:34
    Darshit
    0

    Any Reply on this please need help in urgent!!!!

  • Manish 373 posts 932 karma points
    Jan 30, 2013 @ 07:10
    Manish
    0

    Hi,

     

    I have a node in XML with the name "productPageTitle" and I dont want this node to be a part of search result.

    <ExcludeNodeTypes>
          <add Name="titleProperties"/>
        </ExcludeNodeTypes>

    So I used <ExcludeNodeType> but still as a part of result.

    How can I exclude this node from search results?

Please Sign in or register to post replies

Write your reply to:

Draft