question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose a function to control the sort order

See original GitHub issue

What I would like is to control the sort order. I’m guessing, internally, that Flexsearch has an algorithm for determining which matched document came before another. If I can just get in there an affect the sort for very specific business logic. Something like this maybe:

index.search(query, {
  sort: (a, b) => {
    if (someReason(a)) { return 1 }
    if (someOtherReason(b)) { return -1 }
    return 0
  }
})

Ideally, the sort callback would get the document and each documents match score as determined what internals of Flexsearch (e.g. BM25). For example, I could manually boost the score on docs that should be prioritized.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
peterbecommented, Oct 27, 2021

@ts-thomas Perhaps you can help with a temporary solution. Is there any way I can find out the internal score of my search results. Because if I can have the internal scores, I can retroactively recompute them and re-sort.

0reactions
peterbecommented, Oct 11, 2022

Nope. No progress. And I have up.

On Wed, Apr 13, 2022 at 6:03 PM corey34 @.***> wrote:

@peterbe https://github.com/peterbe did you ever find out how to do this?

— Reply to this email directly, view it on GitHub https://github.com/nextapps-de/flexsearch/issues/283#issuecomment-1098227972, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAGQ45LX6NYVWMLJTLSKMDVE3V4HANCNFSM5GVLGMHA . You are receiving this because you were mentioned.Message ID: @.***>

– GitHub https://github.com/peterbe · Website https://www.peterbe.com/ · Twitter https://twitter.com/peterbe · Side project https://thatsgroce.web.app/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control/Expose Quote Product Line Items Sort Order
It's important to allow Admins to either control the sort order of the Quote Product line items related list according to the available...
Read more >
Controlling the sort sequence used to display lists
All lists have a default sort sequence based on the type of fields present in the list.
Read more >
Order Up! | Custom Sort Orders - Splunk
A how-to on creating custom sort orders for your search results. ... Use the case function to assign a number to each unique...
Read more >
Sort or Order List in R? - Spark by {Examples}
By using lapply() function you can sort the values of the list in R by ascending order, this function takes a list as...
Read more >
Sort Transformation - SQL Server Integration Services (SSIS)
The Sort transformation sorts input data in ascending or descending order and copies the sorted data to the transformation output.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found