I am creating a search index. I've added a custom field into the index using:
e.Fields.Add("_language", "en");
as a GatheringNodeData event. I can see this field and value when looking inside Luke at the index and I can search for it inside examine management e.g. +_language:en
However, when I search from Examine, I get no results. I have debugged through the code and all fields apart from custom fields are returned by Examine. In that same code, I can search for the usual fields just fine, as soon as I add to search the _language field, nothing is returned.
I'm using Umbraco 7.5.13. Any ideas what I'm doing wrong?
var externalSearcher = ExamineManager.Instance.SearchProviderCollection["MySearcher"];
var criteria = externalSearcher.CreateSearchCriteria(UmbracoExamine.IndexTypes.Content);
var query = criteria.Field("_language", "en");
return ExamineManager.Instance.Search(query.Compile());
If I change to:
var externalSearcher = ExamineManager.Instance.SearchProviderCollection["MySearcher"];
var criteria = externalSearcher.CreateSearchCriteria(UmbracoExamine.IndexTypes.Content);
var query = criteria.Field("title", "any title here");
return ExamineManager.Instance.Search(query.Compile());
It returns search results.
In Luke, I have the results coming through without an issue:
var externalSearcher = ExamineManager.Instance.SearchProviderCollection["MySearcher"];
var criteria = externalSearcher.CreateSearchCriteria(UmbracoExamine.IndexTypes.Content);
var query = criteria.Field("_language", "en");
return externalSearcher.Search(query.Compile());
Examine not returning custom fields
Hi everyone.
I am creating a search index. I've added a custom field into the index using: e.Fields.Add("_language", "en");
as a GatheringNodeData event. I can see this field and value when looking inside Luke at the index and I can search for it inside examine management e.g. +_language:en
However, when I search from Examine, I get no results. I have debugged through the code and all fields apart from custom fields are returned by Examine. In that same code, I can search for the usual fields just fine, as soon as I add to search the _language field, nothing is returned.
I'm using Umbraco 7.5.13. Any ideas what I'm doing wrong?
Thank you.
Francis,
Can you paste back your search code.
Regards
Ismail
Hi,
Thanks for the reply.
The search code that is running is:
If I change to:
It returns search results.
In Luke, I have the results coming through without an issue:
Thanks.
I found the issue. I should have been doing:
rather than using:
Thanks for your help. Hopefully this helps someone else.
is working on a reply...