Skip to content

Commit

Permalink
Merge 926a9a0 into ca9319b
Browse files Browse the repository at this point in the history
  • Loading branch information
helllllllder committed Oct 18, 2021
2 parents ca9319b + 926a9a0 commit 9647c88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions bothub/api/v2/repository/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django_elasticsearch_dsl_drf.filter_backends import (
CompoundSearchFilterBackend,
FilteringFilterBackend,
NestedFilteringFilterBackend,
)
from django_elasticsearch_dsl_drf.pagination import LimitOffsetPagination
from django_elasticsearch_dsl_drf.viewsets import DocumentViewSet
Expand Down Expand Up @@ -1153,7 +1154,11 @@ class RepositoryNLPLogViewSet(DocumentViewSet):
serializer_class = RepositoryNLPLogSerializer
lookup_field = "pk"
permission_classes = [permissions.IsAuthenticated, RepositoryLogPermission]
filter_backends = [CompoundSearchFilterBackend, FilteringFilterBackend]
filter_backends = [
CompoundSearchFilterBackend,
FilteringFilterBackend,
NestedFilteringFilterBackend,
]
pagination_class = LimitOffsetPagination
limit = settings.REPOSITORY_NLP_LOG_LIMIT
search_fields = ["text"]
Expand All @@ -1162,9 +1167,15 @@ class RepositoryNLPLogViewSet(DocumentViewSet):
"language": "language",
"repository_version": "repository_version",
"repository_version_language": "repository_version_language",
"intent": "log_intent.intent",
}
nested_filter_fields = {
"intent": {
"field": "nlp_log.intent.name.raw",
"path": "nlp_log",
},
"confidence": {
"field": "log_intent.confidence",
"field": "nlp_log.intent.confidence",
"path": "nlp_log",
"lookups": [LOOKUP_QUERY_LTE, LOOKUP_QUERY_GTE],
},
}
Expand Down
2 changes: 1 addition & 1 deletion bothub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
ELASTICSEARCH_REPOSITORYNLPLOG_INDEX=(str, "ai_repositorynlplog"),
ELASTICSEARCH_REPOSITORYQANLPLOG_INDEX=(str, "ai_repositoryqanlplog"),
ELASTICSEARCH_NUMBER_OF_SHARDS=(int, 1),
ELASTICSEARCH_NUMBER_OF_REPLICAS=(int, 1),
ELASTICSEARCH_NUMBER_OF_REPLICAS=(int, 0),
ELASTICSEARCH_SIGNAL_PROCESSOR=(str, "realtime"),
GUNICORN_WORKERS=(int, multiprocessing.cpu_count() * 2 + 1),
)
Expand Down

0 comments on commit 9647c88

Please sign in to comment.