コード例 #1
0
def search(path=None):
    query = request.args.get('query', '')

    filters = [item.split('=', 1) for item in path.split('/')] \
            if path else []

    ignores = [item[0] for item in filters]

    hits = Document.search(query, filters)
    facets = Document.facets(hits, ignores=ignores)

    return render_template('search.j2', query=query, path=path, hits=hits,
            facets=facets, total=Document.count())
コード例 #2
0
def test_count(database):
    assert Document.count() == 3
コード例 #3
0
def test_load_fixtures():
    db.create_all()

    load_fixtures()

    assert Document.count() == 3