I have recently been working on our company HR site. I implemented a search for the site using Examine. I have been made aware of a problem with the search functionality, it returns the correct results but each link item is just blank and doesn't let the user navigate to the article or feature. The site is very simple and I have not changed anything in the search macro since it was implemented. Could anyone shed any light on this problem?
Please see my attached config files and the CSHTML for the search macro.
<?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
Not sure if this will make any difference but I notice in your index settings you have set the id attribute as "id" (ie lowercase) and in your macro you have "result.Id" - using an upper case "i".
If that dosesn't help at all, it will be usefull to know which version of Umbraco you are using.
Restart IIS and republish the site. Check wether the index folder has anything in it. I had to republish a few times before i got results. That config looks ok to me.
Download luke and look at what is in the file inside of your index :).
Thanks Charles for your reply, I will install Luke now and see if I can get the information. I have republished the site a few times and it seems to make no difference. I have rebuilt the index and when I use the internal search I get these results..which says to me I should be able to access the page by its ID? Although this site is multi-level so do I need to include the parent ID in the construction of the URL?
Hi Ismail, thanks again for your reply! I am determined to get to the bottom of this. Unfortunately I am on version 6, so I cannot use TypedContent..I really am stumped. I can print out the Node Names fine but when it comes to the link it is always a "#" symbol.
You can use in v6, i am assuming that this is a partial that you are working in? Also the statement is in wrong place, so update your code in the following way
THe var umbraco is outside the @ ?? if needs to be inside after the using statements. Also can you edit the partial in visual studio that will give you intellisense and pick up any errors.
Hi Ismail, I am still experiencing problems. I think this will be my last day of trying to fix it, if I can't by the end of today I will look at implementing a different type of search, do you have any recommendations?
That is what I had already implemented when I posted the problem? the search returns the right results, and even the right name for each node that is returned. It's just the link to that node which isn't correct. See my attached screenshot, and look at the bottom left hand corner which is when I hover over the link?! It's just linking back to the search it seems?
Examine Search Problem, links are always blank
Hi,
I have recently been working on our company HR site. I implemented a search for the site using Examine. I have been made aware of a problem with the search functionality, it returns the correct results but each link item is just blank and doesn't let the user navigate to the article or feature. The site is very simple and I have not changed anything in the search macro since it was implemented. Could anyone shed any light on this problem?
Please see my attached config files and the CSHTML for the search macro.
<?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/"/>
<!-- 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>
<IndexSet SetName="MySiteIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/MySite/">
<IndexAttributeFields>
<add Name="id" />
<add Name="nodeName"/>
<add Name="updateDate" />
<add Name="writerName" />
<add Name="email" />
<add Name="nodeTypeAlias" />
</IndexAttributeFields>
<ExcludeNodeTypes>
<add Name="Imgage"/>
<add Name="Folder"/>
</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>
------------------------------------------------------------------------------------------------------------------------------------------------------------
<?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"
analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
<add name="InternalMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
supportUnpublished="true"
supportProtected="true"
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
<add name="MySiteIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
<!-- default external indexer, which excludes protected and unpublished pages-->
<add name="ExternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"/>
</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" />
<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>
Hi,
Not sure if this will make any difference but I notice in your index settings you have set the id attribute as "id" (ie lowercase) and in your macro you have "result.Id" - using an upper case "i".
If that dosesn't help at all, it will be usefull to know which version of Umbraco you are using.
cheers
Restart IIS and republish the site. Check wether the index folder has anything in it. I had to republish a few times before i got results. That config looks ok to me.
Download luke and look at what is in the file inside of your index :).
Charlie
Ismal. its uppecase because its a property in c# code
public int Id {get;set;}
This is a typical naming convention.
The id (lowercase) relates to the a property (in umbraco) alias, which is what lucene looks for :).
Charlie
Thanks Charles for your reply, I will install Luke now and see if I can get the information. I have republished the site a few times and it seems to make no difference. I have rebuilt the index and when I use the internal search I get these results..which says to me I should be able to access the page by its ID? Although this site is multi-level so do I need to include the parent ID in the construction of the URL?
Nick,
In your code instead of :
umbraco.library.NiceUrl(result.Id)
try,
You are running v7 and it may be that the older umbraco.library.NiceUrl is playing up?
Regards
Ismail
Hi Ismail, thanks again for your reply! I am determined to get to the bottom of this. Unfortunately I am on version 6, so I cannot use TypedContent..I really am stumped. I can print out the Node Names fine but when it comes to the link it is always a "#" symbol.
Nick,
You can use in v6, i am assuming that this is a partial that you are working in? Also the statement is in wrong place, so update your code in the following way
before the using examine statement add
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
then in loop do
var node =Umbraco.TypedContent(result.Id);
@node.Url
Regards
Ismail
I am having trouble with where to place the declaration? Am I even close to correct?
Nick,
That should work, what happens when you check ignore errors then save then hit the page does it still error?
Regards
Ismail
I get this error on my page - 'Error loading MacroEngine script (file: SearchResults.cshtml)' :(
Nick,
Ok take that inherits statement out then try:
Regards
Ismail
var Umbraco = new Umbraco.Web.UmbracoHelper(UmbracoContext.Current)
@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>
<ul>
<li>Check your spelling</li>
<li>Try using single words</li>
<li>Try searching for a less specific item</li>
</ul>
}
else
{
<ul class="search-results">
@foreach (var result in results)
{
var node = Umbraco.TypedContent(result.Id);
<li>
<a href="@node.Url">@result.Fields["nodeName"]</a>
</li>
}
</ul>
}
}
that is my code? Still getting the same error......I really do appreciate all your help here!
Nick,
THe var umbraco is outside the @ ?? if needs to be inside after the using statements. Also can you edit the partial in visual studio that will give you intellisense and pick up any errors.
Regards
Ismail
I have made the edits you recommended, it keeps complaining about UmbracoContext, saying it doesn't exist in this context?
I am running version Umbraco v6.1.6 if that is any help?
Hi Ismail, I am still experiencing problems. I think this will be my last day of trying to fix it, if I can't by the end of today I will look at implementing a different type of search, do you have any recommendations?
Nick,
Ok get rid of that Umbraco line and at the point where you want the url try umbraco.library.NiceUrl(result.Id)
Regards
Ismail
That is what I had already implemented when I posted the problem? the search returns the right results, and even the right name for each node that is returned. It's just the link to that node which isn't correct. See my attached screenshot, and look at the bottom left hand corner which is when I hover over the link?! It's just linking back to the search it seems?
Here is my cshtml code:
@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>
<ul>
<li>Check your spelling</li>
<li>Try using single words</li>
<li>Try searching for a less specific item</li>
</ul>
}
else
{
<ul class="search-results">
@foreach (var result in results)
{
<li>
<a href="@umbraco.library.NiceUrl(result.Id)">@result.Fields["nodeName"]</a>
</li>
}
</ul>
}
}
is working on a reply...