1
2
3
4
5
6
7
8
9
10
11
12
def search(request):
    import SwishE
    from django.conf import settings
    
    handle = SwishE.new(settings.SEARCH_INDEX_FILE)
    results = handle.query(request.POST['query'])

    ids = [int(x.getproperty('swishdocpath')) for x in results]

    photos = Photo.objects.in_bulk(ids)
        
    return render_to_response('gallery/search_results.html',{'search': photos,})