Fannon / search-bookmarks-history-and-tabs

Browser extension to search and navigate browser tabs, local bookmarks and history.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

idea: trigger search engine by prefix

Fred-Vatin opened this issue · comments

Hi,

One of the best extension so far I use in Firefox.

There is a feature in the command palette from Vivaldi that would be nice to add in your extension.

It would need to add a property for search engine such as

  - name: Google
    urlPrefix: https://www.google.com/search?q=
    alias: g

When you want to run a search for a term in google you would type g this my search in google and press enter. The search is run in a new tab. Prefix should be detected as soon as you follow them by a space. Then the first result in the list would the name of the search engine stating that the following term will be searched with it. The next items in the list would still be the usual search results from the whole input.

An alias can be one letter to a much long word.

I’ve used this workflow for years and I assure this fast and effective.

Hi,

that's a nice idea. Right now, the extension can already do google search for you, when prefixing your search with s , e.g. g this my search in google.

Then it displays the configured search engines, which you can customize via the config, e.g. like:

searchEngineChoices:
  - name: Google
    urlPrefix: https://google.com/search?q=
  - name: dict.cc
    urlPrefix: https://www.dict.cc/?s=

But I see that you can make such a search even more convenient by having a dedicated prefix. With this, you could even contemplate displaying results directly in the search results (not sure if this is allowed, though?)

Can you check how well the existing functionality works for you?

I use vimium-c that has this feature.

I need as much as search engines that I want. A single default is not enough for every day use. I like the way the vimium omnibar is centered at screen when called. Your extension would benefit to act the same instead of a popup under the extension button. IMHO.

Ok, I see. I've tried vimium as well and this is an extension on a quite different level :)

Some of what you propose goes against some principles of this extension: I made it as a extension popup on purpose, because that means it will only load if you actively triggers it. It doesn't inject itself into every website you visit. Although the feature and the user experience of it is really nice.

But that is independent from the feature of adding custom prefixes. This could work, but needs some thought how it does not clash with the already built in functionality

@freMea : I've just tried this and it seems to be a very easy addition to the extension.

The Options would like following:

customSearchEngines:
  - alias: g
    name: Google
    urlPrefix: https://www.google.com/search?q=
  - alias: d
    name: dict.cc
    urlPrefix: https://www.dict.cc/?s=

image

I'll release it with the next 1.8.0 release.

Nice.

I suggest multi aliases and a fallback when no search suffix is provided.

See vimimum search engine

For instance

customSearchEngines:
  - alias: [g, google]
    name: Google
    urlPrefix: https://www.google.com/search?q=
    blank: https://www.google.com/
  - alias: [du, duck, dgo, duckgo]
    name: DuckDuckGo
    urlPrefix: https://duckduckgo.com/?q=$s
    blank: https://duckduckgo.com/

Some search engines may be more complex. That’s why it should handle placeholder $s

Good suggestions! using the placeholder $s sounds definately as somthing that should be implemented.

Regarding the alias: I'd like keeping the options object simple to write, as it's already difficult for non-programmers to handle it. So I'm not entirely sure on this. Also, having to many aliases could come in conflict with regular search. But I'll think about it. alias could be strong OR array of strings, then it would be flexible.

I don't understand the reason for blank, not sure this would happen with the search extension. If you just want to navigate to Google directly, you can always create a bookmark for it.

I'll reopen this. Here is a PR: #63

It now implements your suggestions, except for the blank option. Not entirely sure on this. I feel that if you use aliases without a search, we're running into the territory where it's essentially just a bookmark. But your thoughts on it are welcome, @freMea !

Maybe an assumption to clarify: When using a custom search engine alias, the extension will execute such a search basically instead of doing regular bookmark search etc. That means when your search term starts with the alias, then it will only offer that custom search engine.
It's like tag search, folder search in that regard.

Not entirely sure if that's what you would expect.
Maybe it's better to display it as the upper most result, but still do regular search entries below.

I've changed the behavior so custom search engines are now not exclusive, just very highly scored.

image

I'll reopen this. Here is a PR: #63

It now implements your suggestions, except for the blank option. Not entirely sure on this. I feel that if you use aliases without a search, we're running into the territory where it's essentially just a bookmark. But your thoughts on it are welcome, @freMea !

Yes, blank acts as a bookmark alias. And because it is the highest rank in the result, when you want to quickly open a bookmark, you can then just type the alias (one or two letters most of the time), enter and voilà !

Ok, I get the idea. I've now tried it out and can see how this can be useful.

image

We could also use blank and omit urlPrefix for the case we just want to create an alias for a bookmark which is not a search engine.

In that case, the name of the option would be kind of a poor wording.

How about not conflating those two things too much and create a separate option / category for that?

image

But I'm really not sure about it. The same can also be achived by just making it a bookmark and giving it a custom score bonus (just append + to the bookmark name)

Yes but what if g is the same alias for the search engine and for the customAliases above ? Would there be two entries in the results while typing g ?

So a search alias works a bit differnetly: It only matches if it is typed in excactly, including a space as a separator for the coming search.

So g would not give you the custom search engine yet. Only g .

Let's say your alias name is also google.
If you want the behavior to already start matching goo or google (without space), then you should use a bookmark for that, as the two search modes have their way of doing this. If you want it to be highly scored, just append +200 or something to the bookmark title. It won't be shown in the result title, but increase its score.

If you now have a custom search and a custom alias / bookmark, then both would be displayed. But if this has a search functionality, it makes more sense to go wit hthe custom search, instead of the plain bookmark anyway, as it has the blank option.

Ok, I'll keep the functionality as of implemented now.
If there is a good case for having custom aliases of their own category (not sure on that), it could be added as a separate feature.