mirror of
https://github.com/perstarkse/minne.git
synced 2026-07-03 11:31:43 +02:00
feat: can now choose search result types
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
{% block title %}Minne - Search{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<div class="flex justify-center grow mt-2 sm:mt-4">
|
||||
<div id="search_pane" class="flex justify-center grow mt-2 sm:mt-4">
|
||||
<div class="container">
|
||||
<section class="mb-4">
|
||||
<div class="nb-panel p-3 flex items-center justify-between">
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
{% extends "search/_layout.html" %}
|
||||
|
||||
{% block search_header %}
|
||||
<h1 class="text-xl font-extrabold tracking-tight">Search</h1>
|
||||
<div class="text-xs opacity-70">Find documents, entities, and snippets</div>
|
||||
<div>
|
||||
<h1 class="text-xl font-extrabold tracking-tight">Search</h1>
|
||||
<div class="text-xs opacity-70">Find document snippets and knowledge entities</div>
|
||||
</div>
|
||||
<form hx-get="/search" hx-target="#search_pane" hx-swap="outerHTML" hx-push-url="true"
|
||||
class="flex items-center gap-1">
|
||||
{% if query_param %}
|
||||
<input type="hidden" name="query" value="{{ query_param }}" />
|
||||
{% endif %}
|
||||
<button type="submit" name="view" value="all"
|
||||
class="nb-btn btn-sm {% if view_param == 'all' %}nb-cta{% else %}btn-ghost{% endif %}">
|
||||
All
|
||||
</button>
|
||||
<button type="submit" name="view" value="chunks"
|
||||
class="nb-btn btn-sm {% if view_param == 'chunks' %}nb-cta{% else %}btn-ghost{% endif %}">
|
||||
Chunks
|
||||
</button>
|
||||
<button type="submit" name="view" value="entities"
|
||||
class="nb-btn btn-sm {% if view_param == 'entities' %}nb-cta{% else %}btn-ghost{% endif %}">
|
||||
Entities
|
||||
</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block search_results %}
|
||||
|
||||
@@ -160,8 +160,8 @@
|
||||
|
||||
{% elif query_param is defined and query_param | trim != "" %}
|
||||
<div class="nb-panel p-5 text-center">
|
||||
<p class="text-xl font-extrabold mb-2">No results for “{{ query_param | escape }}”.</p>
|
||||
<p class="text-sm opacity-70">Try different keywords or check for typos.</p>
|
||||
<p class="text-xl font-extrabold mb-2">No {% if view_param == 'entities' %}entities{% elif view_param == 'chunks' %}chunks{% else %}results{% endif %} for “{{ query_param | escape }}”.</p>
|
||||
<p class="text-sm opacity-70">Try different keywords, check for typos, or switch result type.</p>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="nb-panel p-5 text-center">
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<div class="flex items-center gap-2 min-w-[90px] w-full">
|
||||
<form class="w-full relative" hx-boost="true" method="get" action="/search"
|
||||
hx-trigger="keyup changed delay:500ms from:#search-input, search from:#search-input" hx-push-url="true">
|
||||
{% if view_param is defined and view_param and view_param != 'all' %}
|
||||
<input type="hidden" name="view" value="{{ view_param }}" />
|
||||
{% endif %}
|
||||
<input id="search-input" type="search" aria-label="Search" class=" nb-input w-full pl-9 ml-2" name="query"
|
||||
autocomplete="off" value="{{ query_param | default('', true) }}" />
|
||||
<button type="submit"
|
||||
|
||||
Reference in New Issue
Block a user