Beispiel #1
0
def booksearch(request, q=None):
    q = request.GET.get("q")
    if not q:
        resp_data = err_resp("Please pass q")
    else:
        results = [book.dict for book in search.booksearch(q)]
        resp_data = {
            "status": OK,
            "results": results,
        }

    return HttpResponse(json.dumps(resp_data),
                        content_type=json_mime)
Beispiel #2
0
def search_google_with_query(query):
    """
    Kind of a hacky work around to index books.
    """
    print("Searching google and indexing: %s" % query)
    search.booksearch(query)