mataroa-blog / mataroa

Naked blogging platform
https://mataroa.blog
GNU Affero General Public License v3.0
238 stars 21 forks source link

add search functionality #37

Closed ratsclub closed 1 year ago

ratsclub commented 1 year ago

Context

This introduces the search functionality previously discussed here.

What was done

Notes

One issue is that the indexing is not done automatically, hence the signals.py file. In other to index old data, you can run the following:

from django.contrib.postgres.search import SearchVector

from main.models import Post

Post.objects.update(search_post=SearchVector('title') + SearchVector('body'))
sirodoht commented 1 year ago

About the tests, I would say put them into main/tests/test_posts.py