November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi,
how have you built your query? Here is an example on how the fields are being searched:
// will search in SearchTitle, SearchText, SearchSummary, SearchAttachment
.UnifiedSearchFor(q)
// will search in all fields
.UnifiedSearch().For(q)
// same as UnifiedSearchFor(), but with additional fields
.UnifiedSearch().For(q)
.InStandardFields()
.InField(x => x.SearchCategories)
.InField(x => ((ArticlePage)x).SecondaryBody)
I guess i could specify fields explicitly. That would always work, but it would be better to exclude.
Like this (we also have some other filters and faceting):
ITypeSearch<ISearchContent> query = _epiFindClient
.UnifiedSearchFor(searchParams.SearchString, currentLangauge);
EDIT: It seems like no matter what field I specify, it still get hits in the same fields.
I would consider it a best practice to specify the fields, as there are a lot of information in the index, and in most cases you would not like to enable free text search on everything. I can see what you mean though, something like .NotInField(..) would be nice, but that would require some custom code.
However, since you are using .UnifiedSearchFor(..), you should by default only be searching in SearchTitle, SearchText, SearchSummary and SearchAttachment. At least that is the case with the latest version.
If you still are getting hits on other properties then there must be something else triggering it. Have you implemented a wild card search or something similar?
This:
ITypeSearch<ISearchContent> query = _epiFindClient.UnifiedSearch(currentLangauge)
.For(searchParams.SearchString);
Will search every field, as no fields have been specified.
Try a simple test, and see if that works:
ITypeSearch<ISearchContent> query = _epiFindClient.UnifiedSearch(currentLangauge)
.For(searchParams.SearchString)
.InField(x => x.SearchTitle)
PS! The "SearchText" field will contain all properties that are marked as "Searchable". You could override this by creating a matching property on the page(s).
public class ArticlePage : PageData
{
public string SearchText
{
get { return "Whatever " + this.SearchText(); }
}
}
Hello!
I have some properties in the index (urls etc) that we would like to not get a hit in when we do an unified search.
Is there a way (an attribute, filter etc) to exclude certain properties from an unified search? We need them in the index. just not in the excerpt that is displayed.