Hi Tuomas,
If you want SearchAuthors to be searchable make sure you add the authors information to the SearchText of the item you're indexing.
An example of overriding the SearchText is available on the following page:
Hope it helps,
Paul
Thanks Paul! That should do it.
It's just a bit weird that it doesn't search from the field SearchAuthors, since the documentation says: "The interface declares several properties for which you may search", which includes the field SeachAuthors, which is populated in the index.
Actually overriding the SearchText by an extension method doesn't work. I created a following class for this purpose:
public static class RssContentExtensions
{
public static string SearchText(this RssContent content)
{
IndexValue authors;
if (content.SearchMetaData != null && content.SearchMetaData.TryGetValue("authors", out authors))
{
return content.SearchText + authors.StringValue;
}
return content.SearchText;
}
public static string SearchText(this WebContent content)
{
IndexValue authors;
if (content.SearchMetaData != null && content.SearchMetaData.TryGetValue("authors", out authors))
{
return content.SearchText + " || " + authors.StringValue;
}
return content.SearchText;
}
}
This does not change the indexing. It didn't even hit a breakpoint that I put on both of those functions when indexing.
And the content is coming from an rss connector, if it makes any difference.
Hi Tuomas,
I have the same issue as you. I need the unifiedSearch to filtering SearchAuthors.
Have you found any solution to this?
I have the SearchAuthors in index, and the results. But the filter will not filtering on SearchAuthors.
Gunhild
If we can get RSSPage or RssContent instance then we can try to include the author name in unified search like below within the initialization module:
SearchClient.Instance.Conventions
.ForInstancesOf<RssContent >()
.IncludeField(x => x.AuthorName())
Thank you Sanjay, it worked to add this to EPiServer.Search InitializableModule
SearchClient.Instance.Conventions.ForInstancesOf<RssContent>().IncludeField(x => x.SearchAuthors);
We have a problem with searching RssContent with UnifiedSearch.
We need to be able to search on the field SearchAuthors, which is populated when looking at the index records. However when searching with names in that are in the SearchAuthors, it returns 0 hits. Searching with words in the title or content works well.
I don't know if this is relevant, but when looking at the returned UnifiedSearchHit, the Authors field is null, and the authors key in MetaData is filled with the correct value.