Пример #1
0
def search():

    data = request.get_json()
    """The following line: set serialized object allDocs, which is a copy of the database"""
    service.get_all_documents()
    outputProducts = service.do_query(data)

    return jsonify(outputProducts)
Пример #2
0
def search():

    data = request.get_json()

    #allDocs = service.get_all_documents()
    #outputProducts = service.do_query(data, allDocs)

    #set serialized object
    service.get_all_documents()
    outputProducts = service.do_query(data)

    return jsonify(outputProducts)
Пример #3
0
def alexa_search():

    data = request.get_json()
    intent = data["intent"]
    intent_variable = data["intentVariable"]
    intent_variable_value = data[data["intentVariable"]][data["intentVariable"]
                                                         + "Value"]
    #TODO: boolean method for intentVariable
    #TODO: delete intentVariable with its Value
    data = Backend_Helper.clean_for_alexa(data)
    allDocs = service.get_all_documents()

    outputProducts = service.do_query(data)

    return jsonify(outputProducts[0])
Пример #4
0
def searchText():
    data = request.get_json()

    query = data['searchValue']
    outputProducts = []

    allDocs = service.get_all_documents()

    free_text_searcher = vague_search_freetext.VagueFreeText(es)
    res_search = free_text_searcher.compute_vague_freetext(
        allDocs, query, False)  #False => not boolean search

    outputProducts = Backend_Helper.refineResult(res_search)
    for item in outputProducts:  #binary search results all have a vagueness score of 1
        item[
            'vaguenessScore'] = 1  #todo: change vagueness score to reflect score

        print(outputProducts)
        return jsonify(outputProducts)
Пример #5
0
def alexa_search():

    print('Entered end point..')
    data = request.get_json()
    print(data)
    intent = data["intent"]
    intent_variable = data["intentVariable"]
    intent_variable_value = data[data["intentVariable"]][data["intentVariable"]
                                                         + "Value"]
    #TODO: boolean method for intentVariable
    #TODO: delete intentVariable with its Value
    data = Backend_Helper.clean_for_alexa(data)
    print('Cleaned Date..')
    allDocs = service.get_all_documents()
    print('Got all docs')

    outputProducts = service.do_query(data)

    print('Query done')

    return jsonify(outputProducts[0])