@@ -47,8 +47,7 @@ def test_search(as_public, as_drone, es):
4747 'must': {'match': {'_all': 'search'}},
4848 'filter': {'bool': {'must': [
4949 {'terms': {filter_key + '.raw': filter_value}},
50- {'range': filter_range},
51- {'term': {'permissions._id': None}}
50+ {'range': filter_range}
5251 ]}},
5352 }},
5453 'aggs': {'by_container': {'terms':
@@ -146,6 +145,30 @@ def test_search(as_public, as_drone, es):
146145 assert r.ok
147146 assert r.json['results'] == formatted_file_results
148147
148+ # Drone search without self.uid and all_data set to false
149+ es.search.return_value = {'hits': {'hits': copy.deepcopy(raw_file_results)}}
150+ r = as_drone.post('/dataexplorer/search', json={'return_type': cont_type, 'all_data': False, 'search_string': search_str, 'filters': [
151+ {'terms': {filter_key: filter_value}},
152+ {'range': filter_range},
153+ ]})
154+ es.search.assert_called_with(
155+ body={
156+ '_source': deh.SOURCE[cont_type],
157+ 'query': {'bool': {
158+ 'must': {'match': {'_all': search_str}},
159+ 'filter': {'bool': {'must': [
160+ {'term': {'container_type': cont_type}},
161+ {'terms': {filter_key + '.raw': filter_value}},
162+ {'range': filter_range},
163+ ]}}
164+ }},
165+ 'script_fields': {'info_exists': deh.INFO_EXISTS_SCRIPT},
166+ 'size': 100},
167+ doc_type='flywheel',
168+ index='data_explorer')
169+ assert r.ok
170+ assert r.json['results'] == formatted_file_results
171+
149172 # file search w/ search null filter
150173 es.search.return_value = {'hits': {'hits': copy.deepcopy(raw_file_results)}}
151174 r = as_drone.post('/dataexplorer/search', json={'return_type': cont_type, 'all_data': True, 'filters': [
@@ -350,7 +373,7 @@ def test_aggregate_field_values(as_public, as_drone, es):
350373 r = as_drone.post('/dataexplorer/search/fields/aggregate', json={'field_name': field_name})
351374 es.search.assert_called_with(
352375 body={'aggs': {'results': {'terms': {'field': field_name + '.raw', 'size': 15, 'missing': 'null'}}},
353- 'query': {'bool': {'filter': [{'term': {'permissions._id': None}}], ' must': {'match_all': {}}}},
376+ 'query': {'bool': {'must': {'match_all': {}}}},
354377 'size': 0},
355378 doc_type='flywheel',
356379 index='data_explorer')
@@ -361,7 +384,7 @@ def test_aggregate_field_values(as_public, as_drone, es):
361384 r = as_drone.post('/dataexplorer/search/fields/aggregate', json={'field_name': field_name, 'search_string': search_str})
362385 es.search.assert_called_with(
363386 body={'aggs': {'results': {'terms': {'field': field_name + '.raw', 'size': 15, 'missing': 'null'}}},
364- 'query': {'bool': {'filter': [{'term': {'permissions._id': None}}], ' must': {'match': {'field': search_str}}}},
387+ 'query': {'bool': {'must': {'match': {'field': search_str}}}},
365388 'size': 0},
366389 doc_type='flywheel',
367390 index='data_explorer')
@@ -373,7 +396,7 @@ def test_aggregate_field_values(as_public, as_drone, es):
373396 r = as_drone.post('/dataexplorer/search/fields/aggregate', json={'field_name': field_name})
374397 es.search.assert_called_with(
375398 body={'aggs': {'results': {'stats': {'field': field_name}}},
376- 'query': {'bool': {'filter': [{'term': {'permissions._id': None}}], ' must': {'match_all': {}}}},
399+ 'query': {'bool': {'must': {'match_all': {}}}},
377400 'size': 0},
378401 doc_type='flywheel',
379402 index='data_explorer')
@@ -384,7 +407,7 @@ def test_aggregate_field_values(as_public, as_drone, es):
384407 r = as_drone.post('/dataexplorer/search/fields/aggregate', json={'field_name': field_name, 'search_string': search_str})
385408 es.search.assert_called_with(
386409 body={'aggs': {'results': {'stats': {'field': field_name}}},
387- 'query': {'bool': {'filter': [{'term': {'permissions._id': None}}], ' must': {'match': {'field': search_str}}}},
410+ 'query': {'bool': {'must': {'match': {'field': search_str}}}},
388411 'size': 0},
389412 doc_type='flywheel',
390413 index='data_explorer')
0 commit comments