- Installed django-watson 1.6.3 - Added watson to INSTALLED_APPS - Created search_indexes.py with model registrations: * Post (title, body) * Employee (name, email, phone) * Department (name, description) * Request (title, comment) * Chat (name, description) * Message (content) * CalendarEvent (title, description) - Replaced search/views.py (484 lines → 158 lines) - Applied watson migrations and built search indexes (1015 entries) - Tested search functionality Benefits: - 67% code reduction (326 lines removed) - Better search relevance with full-text indexing - Automatic ranking and highlighting - Less maintenance burden
11 lines
332 B
Python
11 lines
332 B
Python
from django.apps import AppConfig
|
|
|
|
|
|
class SearchConfig(AppConfig):
|
|
default_auto_field = 'django.db.models.BigAutoField'
|
|
name = 'search'
|
|
|
|
def ready(self):
|
|
"""Импортируем регистрации watson при запуске приложения."""
|
|
import search.search_indexes # noqa: F401
|