Skip to content

Commit

Permalink
Fixing source/collection search
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Jul 2, 2021
1 parent 53b7ae6 commit 250d890
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/collections/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Collection(ConceptContainerModel):
'owner_type': {'sortable': False, 'filterable': True, 'facet': True},
'custom_validation_schema': {'sortable': False, 'filterable': True, 'facet': True},
'canonical_url': {'sortable': True, 'filterable': True},
'experimental': {'sortable': False, 'filterable': False, 'facet': True},
'experimental': {'sortable': False, 'filterable': False, 'facet': False},
'external_id': {'sortable': False, 'filterable': True, 'facet': False, 'exact': False},
}

Expand Down
2 changes: 0 additions & 2 deletions core/collections/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class CollectionSearch(CommonSearch):
doc_types = [Collection]
fields = [
'collection_type', 'locale', 'owner', 'owner_type', 'is_active', 'version', 'custom_validation_schema',
'experimental',
]

facets = {
Expand All @@ -20,5 +19,4 @@ class CollectionSearch(CommonSearch):
'is_active': TermsFacet(field='is_active'),
'version': TermsFacet(field='version'),
'customValidationSchema': TermsFacet(field='custom_validation_schema'),
'experimental': TermsFacet(field='experimental'),
}
3 changes: 2 additions & 1 deletion core/common/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def get_exact_search_fields(self):

def get_search_string(self, lower=True):
search_str = self.request.query_params.dict().get(SEARCH_PARAM, '').strip()
search_str = search_str.replace('-', '_')
if self.is_concept_document():
search_str = search_str.replace('-', '_')
if lower:
search_str = search_str.lower()
search_str = search_str if is_url_encoded_string(search_str) else urllib.parse.quote_plus(search_str)
Expand Down
2 changes: 1 addition & 1 deletion core/sources/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Source(ConceptContainerModel):
'owner_type': {'sortable': False, 'filterable': True, 'facet': True},
'custom_validation_schema': {'sortable': False, 'filterable': True, 'facet': True},
'canonical_url': {'sortable': True, 'filterable': True},
'experimental': {'sortable': False, 'filterable': False, 'facet': True},
'experimental': {'sortable': False, 'filterable': False, 'facet': False},
'hierarchy_meaning': {'sortable': False, 'filterable': True, 'facet': True},
'external_id': {'sortable': False, 'filterable': True, 'facet': False, 'exact': False},
}
Expand Down
3 changes: 1 addition & 2 deletions core/sources/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SourceSearch(CommonSearch):
doc_types = [Source]
fields = [
'source_type', 'locale', 'owner', 'owner_type', 'is_active', 'version', 'custom_validation_schema',
'experimental', 'hierarchy_meaning',
'hierarchy_meaning',
]

facets = {
Expand All @@ -20,6 +20,5 @@ class SourceSearch(CommonSearch):
'is_active': TermsFacet(field='is_active'),
'version': TermsFacet(field='version'),
'customValidationSchema': TermsFacet(field='custom_validation_schema'),
'experimental': TermsFacet(field='experimental'),
'hierarchyMeaning': TermsFacet(field='hierarchy_meaning'),
}

0 comments on commit 250d890

Please sign in to comment.