Skip to content

Commit

Permalink
Merge pull request #7611 from readthedocs/respect-feature-flag
Browse files Browse the repository at this point in the history
Search: respect feature flag in dashboard search
  • Loading branch information
stsewd authored Oct 28, 2020
2 parents 9e7ba81 + 5302f1d commit caefb66
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion readthedocs/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.views import View

from readthedocs.builds.constants import LATEST
from readthedocs.projects.models import Project
from readthedocs.projects.models import Feature, Project
from readthedocs.search.faceted_search import (
ALL_FACETS,
PageSearch,
Expand Down Expand Up @@ -75,8 +75,12 @@ def get_serializer_context(self, project, version_slug):

def get(self, request, project_slug=None):
request_type = None
use_advanced_query = True
if project_slug:
project_obj = self._get_project(project_slug)
use_advanced_query = not project_obj.has_feature(
Feature.DEFAULT_TO_FUZZY_SEARCH,
)
request_type = request.GET.get('type', 'file')

version_slug = request.GET.get('version', LATEST)
Expand Down Expand Up @@ -113,6 +117,7 @@ def get(self, request, project_slug=None):
query=user_input.query,
filters=filters,
user=request.user,
use_advanced_query=use_advanced_query,
)
results = search[:self.max_search_results].execute()
facets = results.facets
Expand Down

0 comments on commit caefb66

Please sign in to comment.