Sorting By Format type (pdf /webPage)

Hi ,
I want to put pdf files in the end of search results.Currently pdfs shows up before web pages .I want it the other way

Hi @deepika.saharan,

Thanks for contacting Algolia. As we do not have access to your data, could you share with us an example record structure (simplified is OK) and explain to us how you are currently sorting so that PDFs are showing before Web Pages?

Best,

Hi @ajay.david, I have just started using algolia. Don’t know everything about it. What I can see in my Index > sorting and Ranking there are two custom rankings .PageWeight = ascending and Popularity = ascending. I think its putting pdfs on top by default.

Hi @deepika.saharan,

Thanks for this expansion of detail. Records are usually customized and it sounds like you or a member of your development team shaped your records to have attributes like:

{
PageWeight: xxx,
Popularity: yyy,
... //some other attributes
}

You can determine an order by setting a “Sort By” attribute, this attribute must be numeric so that if you do asc(myAttribute) then it will show those records first.

For example, in your situation you might consider re-indexing your records to have a new attribute that is a boolean (true=1 or false=0):

{
isWebPage: true // 1 value
PageWeight: xxx,
Popularity: yyy,
... //some other attributes
}

Then you can use the Sort By feature with asc(isWebPage) so that web pages are shown first. Please read more about this feature here:

Thank You so much @ajay.david for your help!