Files
DocsMCP/webui/app/templates/search.html
T
2026-06-06 12:38:17 +01:00

45 lines
1.6 KiB
HTML

{% extends "base.html" %}
{% block title %}Search - Context7 Docs{% endblock %}
{% block content %}
<h2>Search Documentation</h2>
<form method="get" action="/search/results" class="search-form">
<label for="query">Query:</label>
<input type="text" id="query" name="q" required placeholder="Enter your search query..." value="{{ query or '' }}">
<label for="limit">Limit results:</label>
<select id="limit" name="limit">
{% for option in [5, 10, 20, 50] %}
<option value="{{ option }}" {% if limit == option %}selected{% endif %}>{{ option }}</option>
{% endfor %}
</select>
<button type="submit">Search</button>
</form>
{% if error %}
<p class="error">Error loading results: {{ error }}</p>
{% elif query and not results %}
<p>No results found.</p>
{% elif results %}
<div class="results-count">{{ results|length }} results found</div>
<div class="results-box">
{% for result in results %}
<article class="result-card">
<h3>{{ result.title or result.path or result.library_id or 'Document result' }}</h3>
<p>{{ (result.content or '')[:500] }}{% if (result.content or '')|length > 500 %}...{% endif %}</p>
<p>
<strong>Library:</strong> {{ result.library_id or 'unknown' }}
{% if result.score is defined %} | <strong>Score:</strong> {{ '%.3f'|format(result.score) }}{% endif %}
</p>
{% if result.library_id %}
<a href="/libraries/{{ result.library_id }}/docs">View library documents</a>
{% endif %}
</article>
{% endfor %}
</div>
{% endif %}
{% endblock %}