Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommended way to boost based on a different field #754

Closed
1 task done
amir20 opened this issue Jan 5, 2024 · 1 comment
Closed
1 task done

Recommended way to boost based on a different field #754

amir20 opened this issue Jan 5, 2024 · 1 comment

Comments

@amir20
Copy link

amir20 commented Jan 5, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Your question

Hello,

I think the closest issue I could find to this is #444. So I'd like to know if I am thinking about this the right way.

I use fuse.js for Dozzle where I show Docker logs. In the UI, users are able to search containers by name. So for example, data might look like

const data = [
  {name: "foo bar", running: true},
  {name: "foo bar", running: false},
  {name: "test", running: true},
  ...
]

When searching for foo I want containers that are running to be on top.

Currently, I do a custom sort after getting back the results from fuse. However, this is not super efficient because I have to receive more results than needed to do a proper sort.

But I wonder if there is a better way. I am familiar with Ellasticsearch and lucene. In those frameworks, I could do something like $query || ($query && running:true)^2) where I am essentially boosting a second query to be at top.

What's the best way to achieve this?

Here are some ideas:

  1. Sort post search like I do now
  2. Use logical queries, but I am not sure how that would be possible because I don't want to specify every single field.
  3. Use an example like Weighted values, not keys? #444 and "boost" weight and resort

Any recommendation would be appreciated. Thank you!

@amir20 amir20 added the question label Jan 5, 2024
Copy link

github-actions bot commented May 5, 2024

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 30 days

@github-actions github-actions bot added the Stale label May 5, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant