Try our conversational search powered by Generative AI!

Possibility to sort NewsPages by updated date and other pages by score in one list of results

Vote:
 

Hi, 

Is there a way to sort NewsPages by updated date and other pages by score in the same results list, So that the oldest newpages get the lowest sort in the list ?

This is how my query looks like: 

var query = querySearch
.UsingUnifiedWeights(GetWeightsValues())
.WithAndAsDefaultOperator()
.UsingSynonyms()
.ApplyBestBets()
.BoostMatching(x => x.MatchType(typeof(ContactPage)), 1.5d)
.BoostMatching(x => x.MatchType(typeof(ProgrammePage)), 1.5d)
.BoostMatching(x => x.MatchType(typeof(CoursePage)), 1.5d)

Thank you in advance!

/Suha

#230632
Nov 10, 2020 8:50
Vote:
 

Checked out auto boosting?

https://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/11/DotNET-Client-API/Searching/auto-boosting/

searchResult = client.Search<BlogPost>()
    .For("Banana")
    .UsingAutoBoost(TimeSpan.FromDays(14))
    .GetResult();

That will increase hits from newly published at least. It will be applied to all page types though so might be an issue. Otherwise boosting news article from last x days might be another option? Similar to this:

var searchResult = client.Search<Car>()
    .For("Volvo")
    .BoostMatching(x => x.InStock.Match(true), 1.5)
    .BoostMatching(x => x.SalesMargin.GreaterThan(0.2), 1.5)
    .GetResult();
#230633
Nov 10, 2020 9:06
Vote:
 

Hi Daniel,

Yes, I have tried autoboosting, it didn't work as I wanted..

I didnt quit understand the second exemple:

.BoostMatching(x => x.SalesMargin.GreaterThan(0.2), 1.5)

If I want to sort newspages after SearchPublishDate , so my oldest news rankes low in my list, how to do it with boosting ? 

#230635
Nov 10, 2020 9:22
Vote:
 

Ok too bad. With boost filters my idea was that if you boost the last month worth of news pages a little you will increase the probability of them ending up on top. Otherwise I can't see any other option than having a secondary search functionality just for news and displaying them separately. You can easily sort them by publication date 

 https://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/11/DotNET-Client-API/Searching/Sorting/

Tricky to support both sorting by relevance and sorting some specific pages by date in the same result. Not sure that is possible? Maybe someone else knows? 

#230636
Nov 10, 2020 9:32
Vote:
 

Alright, maybe I can get around it if I make the oldest newspages have the lowest score, like this.

So that the Newspages that are older then 2 years get a low score and ranks down the list, but what is the lowest score that I can use ?

Is my following code useable ?

.BoostMatching(x=>x.MatchType(typeof(NewsPage)) & x.SearchPublishDate.LessThan(DateTime.Now.AddYears(-2)),0.01d) 

#230639
Nov 10, 2020 10:48
Vote:
 

Yeah I would go with something like that. Easy and gets the job done good enough. 

#230641
Nov 10, 2020 12:23
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.