mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 14:44:18 +00:00
allow full-text search from public index
This commit is contained in:
parent
8a045706ce
commit
89158d5dc7
1 changed files with 4 additions and 2 deletions
|
@ -24,8 +24,9 @@ from ..config import (
|
|||
FOOTER_INFO,
|
||||
SNAPSHOTS_PER_PAGE,
|
||||
)
|
||||
from main import add
|
||||
from ..main import add
|
||||
from ..util import base_url, ansi_to_html
|
||||
from ..search import query_search_index
|
||||
|
||||
|
||||
class HomepageView(View):
|
||||
|
@ -220,8 +221,9 @@ class PublicIndexView(ListView):
|
|||
def get_queryset(self, **kwargs):
|
||||
qs = super().get_queryset(**kwargs)
|
||||
query = self.request.GET.get('q')
|
||||
if query:
|
||||
if query and query.strip():
|
||||
qs = qs.filter(Q(title__icontains=query) | Q(url__icontains=query) | Q(timestamp__icontains=query) | Q(tags__name__icontains=query))
|
||||
qs = qs | query_search_index(query)
|
||||
return qs
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
|
|
Loading…
Reference in a new issue