Fix search
This commit is contained in:
parent
c40a91fb67
commit
26ad68ff69
1 changed files with 2 additions and 2 deletions
|
@ -158,13 +158,13 @@ def cherche(**kwargs):
|
||||||
resultat = Stage.objects.filter(filtres).distinct()
|
resultat = Stage.objects.filter(filtres).distinct()
|
||||||
|
|
||||||
if USE_ELASTICSEARCH and use_dsl:
|
if USE_ELASTICSEARCH and use_dsl:
|
||||||
dls_res = [s.meta.id for s in dsl.scan()[:50]]
|
dsl_res = [s.meta.id for s in dsl.scan()]
|
||||||
resultat = resultat.filter(id__in=dsl_res)
|
resultat = resultat.filter(id__in=dsl_res)
|
||||||
|
|
||||||
if tri == "pertinence":
|
if tri == "pertinence":
|
||||||
resultat = resultat.order_by(
|
resultat = resultat.order_by(
|
||||||
Case(
|
Case(
|
||||||
*[When(pk=pk, then=pos) for pos, pk in enumerate(pks)]
|
*[When(pk=pk, then=pos) for pos, pk in enumerate(dsl_res)]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue