Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I am trying to implement the umbraco Examine search as described in the umbraco website.
http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx
But when I do a search on the page it gives an error message.
Error loading Razor Script JobSearch.cshtmlObject reference not set to an instance of an object.
Below are my configs and codes.
ExamineSettings.config
<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="JobsIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine" dataService="UmbracoExamine.DataServices.UmbracoDataService, UmbracoExamine" supportUnpublished="false" supportProtected="true" interval="1" indexSet="JobsIndexSet" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableDefaultEventHandler="true"/> </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="JobsSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexSet="JobsIndexSet"/> </providers> </ExamineSearchProviders></Examine>
ExamineIndex.config
<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> <!-- 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="JobsIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Jobs/"> <IndexAttributeFields> <add Name="id" /> <add Name="nodeName" /> </IndexAttributeFields> <IndexUserFields> <add Name="title" /> <add Name="column1Content" /> <add Name="column2Content" /> <add Name="umbracoNaviHide" /> </IndexUserFields> <IncludeNodeTypes> <add Name="Jobs"/> </IncludeNodeTypes> <ExcludeNodeTypes /> </IndexSet></ExamineLuceneIndexSets><ExamineIndexProviders> <add name="MyIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"/></ExamineIndexProviders><ExamineSearchProviders> <add name="MySearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"/></ExamineSearchProviders>
JobSearch.cshtml
@inherits umbraco.MacroEngines.DynamicNodeContext@using umbraco.MacroEngines;@using System.Text;@using Examine;@{ string searchParams = Request.QueryString["keywords"]; //string[] searchParams = Request.QueryString["keywords"].Replace(",", " ").Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); IEnumerable<SearchResult> searchResults = new List<SearchResult>(); if(searchParams.Length > 0) { Response.Write(searchParams); var criteria = ExamineManager.Instance .SearchProviderCollection["JobsSearcher"] .CreateSearchCriteria(UmbracoExamine.IndexTypes.Content); var filter = criteria .GroupedOr(new string[] {"nodeName", "title", "column1Content", "column2Content"}, searchParams) .Not() .Field("umbracoNaviHide", "1") .Compile(); searchResults = ExamineManager.Instance.SearchProviderCollection["JobsSearcher"].Search(filter); } <ul> @foreach (SearchResult s in searchResults) { <li> @s.Fields["nodeName"]; </li> } </ul> }
Any help would be much appreciated. :)
Thanks,
Mridul
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Problem implementing Examine search
Hi,
I am trying to implement the umbraco Examine search as described in the umbraco website.
http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx
But when I do a search on the page it gives an error message.
Below are my configs and codes.
ExamineSettings.config
ExamineIndex.config
JobSearch.cshtml
Any help would be much appreciated. :)
Thanks,
Mridul
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.