Skip to content
Snippets Groups Projects
Commit 1a9d7f94 authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Frontend fixes

parent cba52a8e
No related branches found
No related tags found
No related merge requests found
......@@ -251,10 +251,11 @@ class TranscriptionSearch(ListAPIView):
def get_queryset(self):
query = self.request.query_params.get('q')
corpus = self.request.query_params.get('corpus')
type = self.request.query_params.get('type')
return ESQuerySet(
query=ESQuerySet.make_query(
'elastic/search_transcriptions.json',
ctx={'query': query, 'corpus': corpus},
ctx={'query': query, 'corpus': corpus, 'type': type},
),
sort={"score": {"order": "desc", "mode": "max"}},
es_index=settings.ES_INDEX_TRANSCRIPTIONS,
......@@ -272,11 +273,12 @@ class ActSearch(ListAPIView):
def get_queryset(self):
query = self.request.query_params.get('q')
corpus = self.request.query_params.get('corpus')
type = self.request.query_params.get('type')
return ESQuerySet(
_source=False,
query=ESQuerySet.make_query(
'elastic/search_acts.json',
ctx={'query': query, 'corpus': corpus},
ctx={'query': query, 'corpus': corpus, 'type': type},
),
es_index=settings.ES_INDEX_ACTS,
es_type=Act.INDEX_TYPE,
......
......@@ -15,10 +15,14 @@ class TranscriptionSerializer(serializers.ModelSerializer):
Serialises a Transcription
issued from a search
"""
type = EnumField(ElementType)
class Meta:
model = Transcription
fields = (
'id',
'type',
'text',
'line',
'score',
......@@ -200,6 +204,7 @@ class TranscriptionSearchResultSerializer(serializers.ModelSerializer):
"""
Link between objects & their search indexation
"""
type = EnumField(ElementType)
zone = ZoneSerializer()
parents = serializers.ListField(
child=serializers.ListField(
......@@ -212,6 +217,7 @@ class TranscriptionSearchResultSerializer(serializers.ModelSerializer):
model = Transcription
fields = (
'id',
'type',
'text',
'line',
'score',
......
......@@ -22,6 +22,13 @@
}
},
{% endif %}
{% if type %}
{
"match": {
"transcriptions.type": "{{ type }}"
}
},
{% endif %}
{
"match": {
"transcriptions.text": "{{ query }}"
......
......@@ -13,6 +13,13 @@
}
},
{% endif %}
{% if type %}
{
"match": {
"type": "{{ type }}"
}
},
{% endif %}
{
"range": {
"score": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment