Beispiel #1
0
def search_data( req ):
    user_query = req.GET.get( 'user_query', None )
    endpoint   = req.GET.get( 'endpoint', None )
    get_meta   = req.GET.get( 'get_meta', False )

    results = sqldb.search_data( user_query, endpoint, get_meta )

    return HttpResponse( json.dumps( results ))
Beispiel #2
0
def search_data(req):
    user_query = req.GET.get('user_query', None)
    endpoint = req.GET.get('endpoint', None)
    get_meta = req.GET.get('get_meta', False)

    results = sqldb.search_data(user_query, endpoint, get_meta)

    return HttpResponse(json.dumps(results))
Beispiel #3
0
def get_search_data( uri, endpoint, query ):
    data = sqldb.search_data( query, endpoint )

    hits_map = {}
    for box in data['boxes']:
        for row in box:
            hits_map[ row['id'] ] = row['hits']

    cleaned_data = []
    for el in data['data']:
        if el['id'] in hits_map:
            cleaned_data.append({
                'id': el['id'],
                'hit_fields': hits_map[ el['id'] ],
                'uri': create_data_uri( uri, endpoint, el['id'] )
            })

    return cleaned_data
Beispiel #4
0
def get_search_data(uri, endpoint, query):
    data = sqldb.search_data(query, endpoint)

    hits_map = {}
    for box in data['boxes']:
        for row in box:
            hits_map[row['id']] = row['hits']

    cleaned_data = []
    for el in data['data']:
        if el['id'] in hits_map:
            cleaned_data.append({
                'id': el['id'],
                'hit_fields': hits_map[el['id']],
                'uri': create_data_uri(uri, endpoint, el['id'])
            })

    return cleaned_data