etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.2k stars 130 forks source link

Search result #185

Closed jfornech closed 6 years ago

jfornech commented 7 years ago

I got 2 questions: 1) why my result.description is empty while others are filled in the watson model? 2) I know the result.title is from my function of my model

def __unicode__(self):
    return u"{0} - {1}".format(self.numero_sequence, self.problematique) 

but is it possible to get it from a specific field on my model ?

here my apps.py

from __future__ import unicode_literals
from django.apps import AppConfig
from watson import search as watson

class TechnoConfig(AppConfig):
    name = 'techno'

    def ready(self):
        Sequence = self.get_model('Sequence')
        watson.register(Sequence)
        Seances = self.get_model('Seances')
        watson.register(Seances)
        Competence = self.get_model('Competence')
        watson.register(Competence)
vlinhart commented 7 years ago

1) the description would be filled if you had description field on the model 2) you can customize this fully with your own SearchAdapter it's pretty easy - https://github.com/etianen/django-watson/wiki/registering-models#tweaking-search-weighting