Пример #1
0
def search_all(text):    
    # researchers
    indexrsr = get_data.loadIndexRsr(path)
    rsr = get_data.searchIndex(indexrsr, text)

    # projects
    indexprj = get_data.loadIndexPrj(path)
    prj = get_data.searchIndex(indexprj, text)

    # lectures
    indexlec = get_data.loadIndexLec(path)
    lec = get_data.searchIndex(indexlec, text)
    
    # researchers projects collaboration graph
    graph = []
    cache = get_data.getCache(get_data.tblRsrPrjGraphCache, text)
    if len(cache) > 0:
        graph = cache[0]['res']
    else:
        index = get_data.loadIndexRsr(path)
        rsrs = get_data.searchIndex(index, text)
        res = get_data.graphRsrPrj(path, rsrs)
        get_data.tblRsrPrjGraphCache.insert({'query': text, 'res':res})
        graph = res

    # projects histogram
    hist = get_data.getPrjHistogram(prj)
    
    # legislation
    zakoni = get_data.searchAllZakoni()

    # ods
    indexods = get_data.loadIndexOds(path)
    ods = get_data.searchIndex(indexods, text)

    # sio
    indexsio = get_data.loadIndexSio(path)
    sio = get_data.searchIndex(indexsio, text)
    
    # sio categories
    sio_cat = get_data.getUniqSio()

    # er
    ernews = get_data.getERNewsRelated(text)    
    # ernews = get_data.getERNewsDefault()    

    # oer
    indexoer = get_data.loadIndexOer(path)
    oer = get_data.searchIndex(indexoer, text)

    # keyws
    keyws = get_data.getRelatedKeywsRelRsr(rsr)

    return json.dumps({'keyws': keyws, 'oer': oer, 'ernews': ernews, 'sio': sio, 'sio_cat': sio_cat, 'ods': ods, 'zakoni': zakoni, 'rsr': rsr, 'prj':prj, 'lec':lec, 'graph':graph, 'hist': hist})
Пример #2
0
def get_prj_hist(text):
    indexprj = get_data.loadIndexPrj(path)
    prj = get_data.searchIndex(indexprj, text)
    hist = get_data.getPrjHistogram(prj)
    return json.dumps(hist)