From d6c817be8dfb9d41ea3f19cecd90619cde97209d Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 11 Feb 2016 22:43:34 +0100 Subject: [PATCH] opensearch support --- README.rst | 1 + data/templates/base.htm | 1 + data/templates/opensearch.htm | 21 +++++++++++++++++++++ data/templates/opensearchdescription.htm | 9 +++++++++ data/templates/search.htm | 2 +- src/phinde/Helper.php | 18 ++++++++++++++++++ www/index.php | 11 ++++++++++- www/opensearchdescription.php | 17 +++++++++++++++++ www/www-header.php | 2 +- 9 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 data/templates/opensearch.htm create mode 100644 data/templates/opensearchdescription.htm create mode 100644 www/opensearchdescription.php diff --git a/README.rst b/README.rst index 3d10657..7977635 100644 --- a/README.rst +++ b/README.rst @@ -24,6 +24,7 @@ Features - Query: ``foo bar site:example.org/dir/`` - or use the ``site`` GET parameter: ``/?q=foo&site=example.org/dir`` +- OpenSearch support with HTML and Atom result lists ============ diff --git a/data/templates/base.htm b/data/templates/base.htm index f54cd0c..a497f01 100644 --- a/data/templates/base.htm +++ b/data/templates/base.htm @@ -9,6 +9,7 @@ + {% block meta %}{% endblock %} diff --git a/data/templates/opensearch.htm b/data/templates/opensearch.htm new file mode 100644 index 0000000..a1000f1 --- /dev/null +++ b/data/templates/opensearch.htm @@ -0,0 +1,21 @@ + + + "{{query}}" search results + + {{"now"|date("c")}} + {{fullUrl}} + {{hitcount}} + {% for hit in hits %} + {% set doc = hit._source %} + + {{doc.title}} + + {{doc.url}} + {% if doc.modate %} + {{doc.modate|date('c')}} + {% endif %} + {{doc.htmlText|striptags}} + + {% endfor %} + diff --git a/data/templates/opensearchdescription.htm b/data/templates/opensearchdescription.htm new file mode 100644 index 0000000..6bc2f96 --- /dev/null +++ b/data/templates/opensearchdescription.htm @@ -0,0 +1,9 @@ + + + {{apptitle}} + Search + + + diff --git a/data/templates/search.htm b/data/templates/search.htm index c7b1bb7..f0481a9 100644 --- a/data/templates/search.htm +++ b/data/templates/search.htm @@ -18,7 +18,7 @@