def filter_nodes_uuids_in_solr(assay_uuid, filter_out_uuids=[], filter_attribute={}): """ Helper method to create a current selection group which is default for all node_group list :param assay_uuid: unicode, string :param filter_out_uuids: array of unicode, string :param filter_attribute: object of attributes and their filtered fields :return: List of uuids """ # Params required to filter solr_request to just get uuids for nodes params = { 'attributes': 'uuid', 'facets': 'uuid', 'limit': 10000000, 'include_facet_count': 'false' } # Add attribute filters and facet params to generate solr_params if filter_attribute: params['filter_attribute'] = filter_attribute # unicode to object to grab keys if isinstance(filter_attribute, unicode): # handling unicode sent by swagger params['facets'] = ','.join( ast.literal_eval(filter_attribute).keys() ) else: params['facets'] = ','.join(filter_attribute.keys()) solr_params = generate_solr_params(params, assay_uuid) # Only require solr filters if exception uuids are passed if filter_out_uuids: # node_arr = str(filter_out_uuids).split(',') str_nodes = (' OR ').join(filter_out_uuids) field_filter = "&fq=-uuid:({})".format(str_nodes) solr_params = ''.join([solr_params, field_filter]) solr_response = search_solr(solr_params, 'data_set_manager') solr_reponse_json = format_solr_response(solr_response) uuid_list = [] for node in solr_reponse_json.get('nodes'): uuid_list.append(node.get('uuid')) return uuid_list
def get(self, request): solr_response = _get_solr(request.query_params, request.user.id) solr_response_json = format_solr_response(solr_response) return Response(solr_response_json)