November Happy Hour will be moved to Thursday December 5th.

UnifiedSearch not searching in SearchAuthors field on RssContent

Vote:
 

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.

#216224
Jan 30, 2020 6:54
Vote:
 

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:

https://world.episerver.com/documentation/developer-guides/find/NET-Client-API/searching/Unified-search/

Hope it helps,

Paul 

#216241
Jan 30, 2020 14:49
Vote:
 

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.

#216264
Jan 31, 2020 7:28
Vote:
 

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.

#216265
Jan 31, 2020 8:17
Vote:
 

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

#246800
Jan 14, 2021 9:31
Vote:
 

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())
#246879
Jan 15, 2021 7:37
Vote:
 

Thank you Sanjay, it worked to add this to EPiServer.Search InitializableModule

SearchClient.Instance.Conventions.ForInstancesOf<RssContent>().IncludeField(x => x.SearchAuthors);

#246885
Jan 15, 2021 8:34
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.