Powerslice not working as expected

Vote:
 

I am using powerslice for pages and blocks and Media documents in my application. Below is the sample. However when I try to query with file name I dont see something matching the searched text rather the result is just alphabetical list.

I tried to add wildcard search filter but still the result is same. What am I missing.

[ServiceConfiguration(typeof(IContentQuery)), ServiceConfiguration(typeof(IContentSlice))]
public class DocumentsSlice : ContentSliceBase<CategorizableMedia>
{
public override string Name => "Documents";

public override int SortOrder => 2;
protected override ITypeSearch<CategorizableMedia> Filter(ITypeSearch<CategorizableMedia> searchRequest, ContentQueryParameters parameters)
{
var searchText = parameters?.AllParameters["q"] ?? "";
var filter = searchRequest.WildCardSearch($"{searchText.ToLower()}*", f => f.Name);

return base.Filter(filter, parameters);
}
}

#209745
Nov 20, 2019 2:10
Vote:
 

Hi Dileep,

Are you saying this doesn't work even without Filter override? What about the other slices you mentionpages and blocksdo they work?

Overall, this looks valid to me. What is the GET request to /EPiServer/cms/Stores/contentstructure returning when you type in a query?

#210428
Nov 22, 2019 19:04
Dileep D - Dec 03, 2019 16:01
So I have removed the filter and power slice seems to work. However I notice that exact matches or most favorable match isn't always the top result. For example , If I search for "Distribution Center" which is a document available , the top result is "2017 Distribution Center" or sometimes "2018 Distribution Center" while the exact match is in 4th or 5th result. This was the reason I was trying to play around with filter.
* 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.