Tous les résultats
This commit is contained in:
parent
686999b97d
commit
d9acdfc155
1 changed files with 9 additions and 9 deletions
|
@ -57,7 +57,7 @@ def cherche(**kwargs):
|
|||
# Champ générique : recherche dans tous les champs
|
||||
if field_relevant("generique"):
|
||||
#print "Filtre generique", kwargs['generique']
|
||||
dsl = dsl.filter(
|
||||
dsl = dsl.query(
|
||||
"match",
|
||||
_all={"query": kwargs["generique"],
|
||||
"fuzziness": "auto"})
|
||||
|
@ -65,15 +65,15 @@ def cherche(**kwargs):
|
|||
|
||||
# Sujet -> Recherche dan les noms de sujets et les thématiques
|
||||
if field_relevant("sujet"):
|
||||
dsl = dsl.filter("multi_match",
|
||||
dsl = dsl.query("multi_match",
|
||||
query = kwargs["sujet"],
|
||||
fields = ['sujet^2', 'thematiques'],
|
||||
fields = ['sujet^2', 'thematiques', 'matieres'],
|
||||
fuzziness = "auto")
|
||||
use_dsl = True
|
||||
|
||||
# Contexte -> Encadrants, structure, lieu
|
||||
if field_relevant("contexte"):
|
||||
dsl = dsl.filter("multi_match",
|
||||
dsl = dsl.query("multi_match",
|
||||
query = kwargs["contexte"],
|
||||
fields = ['encadrants', 'structure^2',
|
||||
'lieux.nom', 'lieux.pays', 'lieux.ville'],
|
||||
|
@ -107,7 +107,7 @@ def cherche(**kwargs):
|
|||
|
||||
# Application
|
||||
if use_dsl:
|
||||
filtres &= Q(id__in=[s.meta.id for s in dsl])
|
||||
filtres &= Q(id__in=[s.meta.id for s in dsl.scan()])
|
||||
|
||||
#print filtres
|
||||
resultat = Stage.objects.filter(filtres)
|
||||
|
|
Loading…
Reference in a new issue