sophie-glk / bang

A firefox addon which adds bangs (known from duckduckgo) to various search engines.
MIT License
46 stars 5 forks source link

Support bangs anywhere in the query #14

Closed mwaldrich closed 3 years ago

mwaldrich commented 3 years ago

While bangs in the beginning of the query are very helpful, DuckDuckGo supports bangs anywhere in the query. Supporting bangs anywhere in the search query can be very useful if you decide to use a bang after typing the query.

Could this feature be added? I looked through the source code and it doesn't look too bad to implement. It would require searching each word in the query for a bang as opposed to just the first word: https://github.com/sophie-glk/bang/blob/58ac6d3874655a9017ffc1c8a6ae6d65ce6b88aa/plugin/bang.js#L15 It seems like nothing else would need to be done, as this extension doesn't seem to be responsible for trimming the bang from the search query anyway; instead, DuckDuckGo does this after this extension passes the raw search query to it.

Example interaction with DuckDuckGo using bangs at the end of the query:

Search: Environment variables !aw

should use the !aw bang and search the ArchWiki for "Environment variables".

Another DuckDuckGo example:

Search: Environment !aw variables

should again use the !aw bang and search the ArchWiki for "Environment variables"

sophie-glk commented 3 years ago

It should be working now! Could you try it out ( its on the develop branch) and tell me if there are any bugs / if its working as expected?

mwaldrich commented 3 years ago

Thanks for the implementation! I just tested it out in Firefox and it seems to be working great!

I wasn't able to find any bugs, and I tested:

nicolasmaia commented 3 years ago

This isn't working for me when using Ecosia.