philomena-dev / philomena

Next-generation imageboard
GNU Affero General Public License v3.0
84 stars 29 forks source link

Support OpenSearch description format for quick searching #203

Closed mysliwy112 closed 1 month ago

mysliwy112 commented 6 months ago

Is your feature request related to a problem? Please describe. OpenSearch is format used by browsers to enable sites' search engines through the url bar ie. you can use site's search functionality like you can use google by just typing queries into url bar. Implementing it for philomena would add quick option to search images from the booru without having to go to the site first.

Examples of sites using it:

https://www.fimfiction.net/ https://static.fimfiction.net/search/stories.xml

https://github.com/ https://github.com/opensearch.xml

Describe the solution you'd like As specified in link above this option requires addition of OpenSearch description file and \ tag to website's \<head> section to advertise it to browsers.

Here is example of how these elements might be written if they were made for derpibooru:

<link rel="search" type="application/opensearchdescription+xml" title="Derpibooru" href="/opensearch.xml" />

/opensearch.xml:

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
  <ShortName>Derpibooru</ShortName>
  <Description>Derpibooru image search</Description>
  <InputEncoding>UTF-8</InputEncoding>
  <Image width="16" height="16" type="image/x-icon">https://derpibooru.org/favicon.ico</Image>
  <Url type="text/html" method="get" template="https://derpibooru.org/search">
    <Param name="q" value="{searchTerms}"/>
  </Url>
</OpenSearchDescription>

Describe alternatives you've considered There is option of creating user plugin for the site, which I didn't look into yet.

Additional context In case of Firefox it'll show option of adding site's search engine to the browser, and allow querying it through the url bar image

using fimfiction option: image

would result in: image