I have some trouble with the examine sitesearch in Umbraco 7.2.2. The sitesearch is working when I only use the attributes of the result like Id and Name.
When I use the folowing code the searchresults stays empty. I can't find any solution...
@{
string searchTerm = Request.QueryString["keywords"];
if (String.IsNullOrWhiteSpace(searchTerm))
{
searchTerm = "";
}
var searcher = ExamineManager.Instance;
var searchCriteria = searcher.CreateSearchCriteria();
var query = searchCriteria.GroupedOr(new[] { "nodeName", "name", "title", "bodyText", "seo" }, searchTerm).Compile();
var searchResults = searcher.Search(query).Where(r => r["__IndexType"] == "content").ToList();
}
@if (@searchResults.Any())
{ ... Do stuff with it ...}
Is this a old code snippet? Or am I doing something wrong?
<?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>
<IndexUserFields>
<add Name="title"/>
<add Name="subTitle"/>
<add Name="contentgrid"/>
<add Name="mainHeader"/>
<add Name="contentgrid"/>
<add Name="metaTitle"/>
</IndexUserFields>
<IncludeNodeTypes>
<add Name="Home"/>
<add Name="Contentpage"/>
<add Name="Contactpage"/>
</IncludeNodeTypes>
<ExcludeNodeTypes>
</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>
Contentgrid is a umbraco grid. Can examine index a grid?
Sitesearch with examin
Hi all,
I have some trouble with the examine sitesearch in Umbraco 7.2.2. The sitesearch is working when I only use the attributes of the result like Id and Name.
When I use the folowing code the searchresults stays empty. I can't find any solution...
Is this a old code snippet? Or am I doing something wrong?
Frans
I changed the following and I only get a result if I search for a nodename...
My config file looks like this:
Contentgrid is a umbraco grid. Can examine index a grid?
Frans,
Open the index using luke then see what you have in contentgrid field, i suspect its json? Can you report back please.
Regards
Ismail
is working on a reply...