20

What: Add a search operator (I suggest @) which can be used with established ! shortcuts to instead initiate a site: search on the relevant domain.

Example:

  1. User searches for testing @w
  2. Kagi sees that !w redirects to a page at wikipedia.org
  3. Kagi displays results for testing site:wikipedia.org

Why: Kagi is better than most websites’ own search engines, so I often want to use Kagi to search a site rather than using a bang operator. Typing out the full site: operator takes a long time, and this would be much quicker!

Implementation:

  • This could be handled in the same way as bangs and custom search shortcuts are (i.e. it redirects to a Kagi URL containing “site:example.com”, and that’s what the user sees in the search field of the results page). This means that the user can edit the domain if necessary (e.g. specifying a subdomain or subdirectory), and might make it somewhat simpler to implement, as well.
  • I can see arguments for either including subdomains or only the second-level domain and TLD — for example, !w actually points to a page at en.wikipedia.org; should @w point there or to wikipedia.org? I would suggest the latter, but I would be happy with either implementation, and it might be more useful to include subdomains. Opinions welcome below.
  • [edited to add:] Like bangs, custom search shortcuts should take precedence, and @ should use the domain specified by the user if a custom shortcut exists for the string.
  • Vlad replied to this.

    If this proposal ends up in Kagi, some means of escaping the @-character would be useful.

    Examples:

    • \@w should literally search for @w.
    • Searches like user@domain should not trigger this system.

    Searches should behave like normal and not trigger this system unless the query matches something similar to the following regular expression (note the requirement of a space):
    ^.+ @[a-zA-Z0-9]+$

    Edits: Trying to get the text formatting right.

      CatX Certainly agree with the space requirement! That’s how ! works and I would certainly expect them to behave the same.

      However as Kagi currently stands, I don’t think searching for @w or even "@w" searches for the symbol — the first result is the wikipedia page for the letter W, which doesn’t contain any instances of @ at all. (and ditto for !)

        a year later

        It may be cool to integrate this with lenses. Like @lens to trigger a search within a specific lens in addition to a site.

        • Vlad replied to this.
          11 days later

          Vlad I guess you could call it a bong! I wasn’t thinking it would need a name (other search operators don’t, like subtraction/exclusion) but just as long as you don’t call it “bung” I’ll be happy lol

          In terms of discovery (which you mentioned on Discord), I’d put it in the same category as the standalone ! — not a DDG original bang feature, but part of how it’s implemented in Kagi, and mentioned as an option on any page bangs are mentioned.

            11 days later

            Not every site has a way to search via url.com/search=query.

            It will be nice to enable query !url custom bang to just do a kagi search of query site:url.com.

              Interesting idea. I could see the use for this as well.

                Merged 2 posts from Custom Bangs to search via site:url.com.

                  If everyone agrees we should call this bongs and that it works like bangs, just gets the target domain and performs a site search on it, I think we can push this through to implementation.

                    Vlad Why not just call it "at" since it's an "at" operator just like "!" is a bang operator?

                    Or you could also call them "Site Bangs" and make that the title of the relevant section in the Bang documentation analogous to the "Quick Bangs" and "Custom Bangs" section titles.

                    • Vlad replied to this.

                      CrunchyFritos Site bangs is too similar. And it does not lend itself well to spoken use as you end up with 'ats'.

                        You can actually do this already if you create a custom bang (https://kagi.com/settings?p=custom_bangs) and use Kagi as the URL. I think the Reddit search is terrible, so prefer to have a search on Kagi for Reddit results.

                        my query !r

                        can be banged to search for:

                        my query site:reddit.com

                        Enable it in the list of quick bangs to search Reddit by adding just one character to the end.

                        My custom bang options
                        Search engine name: Reddit with Kagi
                        URL: https://kagi.com/search?q=%s+site:reddit.com
                        Bang shortcut: r
                        URL Encode Query: ON

                          Sectimus Clever workaround. Maybe this can just be added to the documentation for bangs instead of creating bongs? Seems like a simpler solution for what is likely a power user feature anyway.

                            CrunchyFritos How is a multi-step process for every single bang you anticipate using this for “simpler” than changing ! to @ ?

                            I actually already had two of these workaround custom bangs set up when I suggested this feature, and I still look forward to it! 🙂

                              tuesday Fair. I was thinking more from the side of avoiding feature bloat. Adding a Site Bang isn't much more complex than creating a custom bang if all it takes is making a bang for e.g. "https://kagi.com/search?q=%s+site:reddit.com". Unless I'm missing something obvious, all the user needs to do is change the site at the end and the feature is implemented?

                                CrunchyFritos I foresee this as being a feature I would want to use spontaneously—yes, I would set it up for Wikipedia and Reddit, but there are lots of other sites I only use occasionally that wouldn’t be worth the effort of setting something like this up (but using a “bong” would be quicker than typing out “site:something.com”).

                                On top of this, there’s the fact that I want to have the option of searching via Kagi or the website itself, and while it’s possible to set up custom bangs with different names for each of them (e.g. !r and !rkagi) that adds further complexity.

                                  tuesday Ah, gotcha. Makes sense. Being able to use a bong instead of a bang for any existing bang shortcut is significantly different than having to custom make a site bang for each use case. My mistake for misunderstanding that.