graphene_elastic.filter_backends.score package¶
Submodules¶
graphene_elastic.filter_backends.score.common module¶
- class graphene_elastic.filter_backends.score.common.ScoreFilterBackend(connection_field, args=None)[source]¶
Bases:
BaseBackend
Score filter backend.
Sample query would be:
- query {
- allPostDocuments(
search:{content:{value:”since”}, title:{value:”decide”}}
) { edges {
- node {
title content score
} cursor
}
}
}
- field_belongs_to(field_name)[source]¶
Check if given filter field belongs to the backend.
- Parameters:
field_name –
- Returns:
- get_backend_document_fields()[source]¶
Get additional document fields for the backend.
For instance, the
Highlight
backend add additional field namedhighlight
to the list of fields.Sample query:
- query {
- allPostDocuments(search:{title:{value:”alice”}}) {
- edges {
- node {
id title highlight
}
}
}
}
Sample response:
- {
- “data”: {
- “allPostDocuments”: {
- “edges”: [
- {
- “node”: {
“id”: “UG9zdDp5a1ppVlcwQklwZ2dXbVlJQV91Rw==”, “title”: “thus Alice style”, “highlight”: {
- “title”: [
“thus <b>Alice</b> style”
]
}
}
]
}
}
}
That
highlight
part on both sample query and sample response isn’t initially available on the connection level, but added with help of the filter backend. :return:
- has_query_fields = False¶
- prefix = 'score'¶
- score_field_name = 'score'¶
- property score_fields¶
Score filter fields.