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

Managing sorting of multiple sources in consult-omni-multi #42

Open
Gleek opened this issue Dec 29, 2024 · 2 comments
Open

Managing sorting of multiple sources in consult-omni-multi #42

Gleek opened this issue Dec 29, 2024 · 2 comments
Labels
back-end and implementation Question/Discussion on back-end impementation and design help wanted Extra attention is needed

Comments

@Gleek
Copy link

Gleek commented Dec 29, 2024

Is your feature request related to a problem? Please describe.

The ordering of individual groups within consult-omni-multi appears unpredictable and beyond user control.

For instance, I added a small source that simply appends "Search {query} with DuckDuckGo" and similar options. However, it frequently appears at the top, whereas I’d prefer it to be closer to the bottom.

Screenshot 2024-12-29 at 5 53 33 PM

In the screenshot above, I’m searching for "graph." While it identifies Applications and Agenda entries, it prioritizes a less relevant section.

This behavior isn’t consistent either.

Screenshot 2024-12-29 at 5 53 51 PM

Here, searching for "emoj" includes the same section, but more relevant ones (like the buffer source) are at the top.

The order doesn’t remain static; items occasionally jump around, and I can’t determine what’s causing this inconsistency.

Describe the solution you'd like

An ideal solution would involve dynamic ordering based on a base weight combined with the relevance of the match.

As a starting point, a static ordering based on the sequence in which sources are listed in consult-omni-multi-sources would be helpful.

This issue may extend beyond consult-omni and relate to the underlying behavior of consult and the consult--multi API, but my understanding of these systems is insufficient to make that determination.

Describe alternatives you've considered

NA

Additional context

All related code is available here

Relevant code in part:

(defun +launch-default-launcher()
    (interactive)
    (let* ((consult-omni-multi-sources
            '("Numi" "Apps" "Org Agenda" "Buffer" "Static launcher" "DuckDuckGo API" "Web search"))
           (consult-async-split-style nil)) ; Remove that # from the beginning of the search. Nothing seems to be affected.
      (+launch-consult-omni)))
;; this is the function in the screenshot above

The code for "Static launcher" and "Web search" sources is included in the linked file above

@armindarvish
Copy link
Owner

@Gleek, please see the discussion on this thread: #1 and the link to the discussion on the predecessor, consult-web.

In short, the order of the items are determined by the order they arrive. Local sources tend to return results faster than web requests. In addition, web requests results often arrive in chunks, so sometimes the first few results from a web source arrive early but the remaining arrive later after other sources. Because of the way grouping works in a multi-source, these results are added to their own group, which makes it look like things are jumping around.

Based on previous discussion in the thread I linked above, there is a potential path to fix this, but it requires some deep dive to get it to work and I have not had any time to work on that.

@armindarvish armindarvish added help wanted Extra attention is needed back-end and implementation Question/Discussion on back-end impementation and design labels Dec 29, 2024
@Gleek
Copy link
Author

Gleek commented Jan 2, 2025

Continuing this further in #1. You can close this if you prefer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end and implementation Question/Discussion on back-end impementation and design help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants