What applications / solutions are most suitable for searching by model in Django?

I have a Django application where most of the search is controlled by foreign keys. For example, assuming Student, School, State, and EducationalQualification are Django models, the user will search for students by specifying search criteria, choosing from schools, states, degrees, diplomas, etc. That is, the search for students is essentially the answer to the question "Show students who belong to the following schools and who belong to the following states and have the following degrees / diplomas."

My Django application uses only the database - there are no documents or web pages to search.

In this case, when the search for Django models is mainly focused on the foreign keys that the model has, which search applications / solutions are most suitable? The ones I looked at all talk a lot about full-text search, I could be wrong, but I don't think this is appropriate in my case.

EDIT: - I'm currently looking using the approach of Peter Herndon ( http://www.slideshare.net/tpherndon/django-search-presentation ). But it is expected that this will be a site with high traffic, and I am concerned about speed and performance.

+3
source share
5 answers
+2

django-filter - Django, queryset .

:)

+1

, Solr/Haystack?

Haystack Solr (Lucene), .

http://haystacksearch.org/

Woosh ( Haystack), Solr.

0

, , , , - . , , . - , . , , . , .

, sphinx, haystack .., Google, , .

0

celopes, django-haystack , "" .

, ...

class Teacher(mdoels.Model):
    name = models.CharFiel(max_length=100)

class Course(models.Model):
    name = models.CharField(max_length=100)
    teacher = models.ForeignKey(Teacher)

class Student(models.Model):
    name = models.CharFiel(max_length=100)
    grade = models.IntegerField()
    classes = models.ManyToManyField(Course, related_name='students')

class Grade(models.Model):
    value = models.CharField(max_length=1)
    course = models.ForeignKey(Course)
    student = models.ForeignKey(Student, related_name='grades')

...

{% comment %} In this context 'object' represents a Course model {% endcomment %}
<h1>{{ object.name }}</h1>
<h2>{{ object.teacher.name }}</h2>
<ul>
{% for student in object.students %}
    <li>{{ student.name }}</li>
{% endfor %}
</ul>

, "", , HTML (h1 , h2, , ).

"" ...

\> manage.py reindex

, seutp cron/Scheduler , .

Solr also includes some neat things, such as spelling suggestions, and all these neat things. I initially tried Whoosh with haystack, but was indicated by the fact that he was doing funny things that the girls were in. Haystack + Solr is a great combo.

0
source

Source: https://habr.com/ru/post/1720749/


All Articles