raycast / extensions

Everything you need to extend Raycast.
https://developers.raycast.com
MIT License
5.23k stars 2.93k forks source link

[Google Chrome] Order-insensitivity: search "foo bar"not works with title/url "bar foo" #14042

Open itszhengkun opened 1 month ago

itszhengkun commented 1 month ago

Extension

https://www.raycast.com/Codely/google-chrome

Raycast Version

1.81.1

macOS Version

14.5

Description

search "foo bar"not works with title/url "bar foo"

when I search "foo bar", I just want bookmarks that contains "foo" and "bar", ignore the order and word case.

image

I check the source code, it just check whether title/url contains the query

image

I clone the extension code, and change the filter code, and it works fun.

But i don't know how to make a pull request and republish the extension

useEffect(() => {
    getBookmarks(profile)
      .then((bookmarks) => {
        const regList = query?.split(" ").filter(s => s).map(s => new RegExp(s, "i"));
        let filteredBookmarks : HistoryEntry[] = bookmarks
        if (regList) {
          filteredBookmarks = bookmarks.filter(b => regList.every(r => r.test(b.title) || r.test(b.url)));
        }
        setData(filteredBookmarks);
        setIsLoading(false);
      })
      .catch((e) => {
        if (e.message === NOT_INSTALLED_MESSAGE) {
          setErrorView(<NotInstalledError />);
        } else if (e.message === NO_BOOKMARKS_MESSAGE) {
          setErrorView(<NoBookmarksError />);
        } else {
          setErrorView(<UnknownError />);
        }
        setIsLoading(false);
      });
  }, [profile, query]);

Steps To Reproduce

  1. create a bookmark named "bar foo" in chrome
  2. open raycast Search Bookmarks Command of Goolge Chrome, and type "foo bar", the "bar foo" should be returned, actually there is no result

Current Behaviour

no bookmarks returned

Expected Behaviour

return the bookmarks that contains the words of query string

raycastbot commented 1 month ago

Thank you for opening this issue!

🔔 @rgomezcasas @bromanko @crisboarna @andreaselia @rtyke @karolre @Aiee @nagauta @a-laughlin @tleo19 you might want to have a look.

💡 Author and Contributors commands The author and contributors of `Codely/google-chrome` can trigger bot actions by commenting: - `@raycastbot close this issue` Closes the issue. - `@raycastbot close as not planned` Closes the issue as not planned. - `@raycastbot rename this issue to "Awesome new title"` Renames the issue. - `@raycastbot reopen this issue` Reopens the issue. - `@raycastbot assign me` Assigns yourself to the issue. - `@raycastbot good first issue` Adds the "Good first issue" label to the issue. - `@raycastbot keep this issue open` Make sure the issue won't go stale and will be kept open by the bot.