Implement searching individual fields

So far only for the public view, since we already have a custom search
form there, where this is easy to add.
This initial implementation supports the common set of metadata fields
that the searchbar placeholder also mentions, but adding more fields
is trivial.
This commit is contained in:
Lucas Schwiderski 2024-06-19 16:50:16 +02:00
parent 8d1d39b21e
commit 10f0c4a077
No known key found for this signature in database
GPG key ID: AA12679AAA6DF4D8
2 changed files with 35 additions and 2 deletions

View file

@ -6,6 +6,15 @@
<form id="changelist-search" action="{% url 'public-index' %}" method="get">
<div>
<label for="searchbar"><img src="/static/admin/img/search.svg" alt="Search"></label>
<select name="query_type" id="query_type">
<option value="all" selected>All</option>
<option value="fulltext">Content</option>
<option value="meta">Metadata</option>
<option value="url">URL</option>
<option value="title">Title</option>
<option value="timestamp">Timestamp</option>
<option value="tags">Tags</option>
</select>
<input type="text" size="40" name="q" value="" id="searchbar" autofocus placeholder="Title, URL, tags, timestamp, or content...".>
<input type="submit" value="Search" style="height: 36px; padding-top: 6px; margin: 8px"/>
<input type="button"