Exemple #1
0
 def test_indices_str(self):
     idx_str = ElasticSettings.indices_str()
     self.assertTrue(idx_str in [
         IDX['GFF_GENERIC']['indexName'] + ',' +
         IDX['MARKER']['indexName'], IDX['MARKER']['indexName'] + ',' +
         IDX['GFF_GENERIC']['indexName']
     ])
Exemple #2
0
def search(request, query, search_idx=ElasticSettings.indices_str()):
    ''' Renders a elastic results page based on the query '''

    aggs = Aggs(Agg("categories", "terms", {"field": "_type", "size": 0}))
    elastic = Search.field_search_query(query, aggs=aggs, fields=fields,
                                        search_from=0, size=20, idx=search_idx)
    result = elastic.search()
    context = {}
    context['diseases'] = _add_diseases()
    context['total'] = result.hits_total
    context['db'] = result.idx
    context['size'] = result.size
    context['query'] = result.query
    context["idxs"] = _categories(result.idx)
    return render(request, 'search/searchresults.html', context,
                  content_type='text/html')
Exemple #3
0
def range_overlap_search(request, src, start, stop, search_idx=ElasticSettings.indices_str()):
    ''' Renders a elastic result page based on the src, start and stop '''
    elastic = Search.range_overlap_query(src, start, stop, idx=search_idx)

    result = elastic.search()
    context = {}
    context['diseases'] = _add_diseases()
    context['total'] = result.hits_total
    context['db'] = result.idx
    context['size'] = result.size
    context['query'] = result.query
    context["idxs"] = _categories(result.idx)
    context["chromosome"] = src
    context["start"] = start
    context["stop"] = stop
    return render(request, 'search/searchresults.html', context,
                  content_type='text/html')
Exemple #4
0
def search(request, query, search_idx=ElasticSettings.indices_str()):
    ''' Renders a elastic results page based on the query '''

    aggs = Aggs(Agg("categories", "terms", {"field": "_type", "size": 0}))
    elastic = Search.field_search_query(query,
                                        aggs=aggs,
                                        fields=fields,
                                        search_from=0,
                                        size=20,
                                        idx=search_idx)
    result = elastic.search()
    context = {}
    context['diseases'] = _add_diseases()
    context['total'] = result.hits_total
    context['db'] = result.idx
    context['size'] = result.size
    context['query'] = result.query
    context["idxs"] = _categories(result.idx)
    return render(request,
                  'search/searchresults.html',
                  context,
                  content_type='text/html')
Exemple #5
0
def range_overlap_search(request,
                         src,
                         start,
                         stop,
                         search_idx=ElasticSettings.indices_str()):
    ''' Renders a elastic result page based on the src, start and stop '''
    elastic = Search.range_overlap_query(src, start, stop, idx=search_idx)

    result = elastic.search()
    context = {}
    context['diseases'] = _add_diseases()
    context['total'] = result.hits_total
    context['db'] = result.idx
    context['size'] = result.size
    context['query'] = result.query
    context["idxs"] = _categories(result.idx)
    context["chromosome"] = src
    context["start"] = start
    context["stop"] = stop
    return render(request,
                  'search/searchresults.html',
                  context,
                  content_type='text/html')