uccser/cs-field-guide

View on GitHub
csfieldguide/search/settings.py

Summary

Maintainability
A
0 mins
Test Coverage
"""Settings for the search application."""
from appendices.models import Appendix
from chapters.models import Chapter, ChapterSection, GlossaryTerm
from interactives.models import Interactive
from search.utils import get_search_model_types

SEARCH_PAGINATION = 25
SEARCH_RESULT_TEMPLATE_DIRECTORY = 'search/results/'


# List of dicts of class, boost value, required prefetches.
SEARCH_CLASSES = [
    {
        'class': Chapter,
        'boost': 1,
    },
    {
        'class': ChapterSection,
        'boost': 0.9,
    },
    {
        'class': GlossaryTerm,
        'boost': 0.7,
    },
    {
        'class': Interactive,
        'boost': 0.7,
        'filter': {'is_interactive': True}
    },
    {
        'class': Appendix,
        'boost': 0.6,
    },
]
SEARCH_PAGES = []


# -----------------------------------------------------------------
# Settings autogenerated from settings above:
SEARCH_MODEL_TYPES = get_search_model_types(SEARCH_CLASSES)