瀏覽代碼

[search] Search should use collection name and not id

Romain Rigaux 12 年之前
父節點
當前提交
8497cb0
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      apps/search/src/search/views.py

+ 2 - 2
apps/search/src/search/views.py

@@ -58,8 +58,7 @@ def index(request):
   if search_form.is_valid():
     collection_id = search_form.cleaned_data['collection']
     if request.GET.get('collection') is None:
-      collection_id = request.COOKIES.get('hueSearchLastCollection', hue_collections[0].id)
-    solr_query['collection'] = collection_id
+      collection_id = request.COOKIES.get('hueSearchLastCollection', hue_collections[0].id)    
     solr_query['q'] = search_form.cleaned_data['query']
     solr_query['fq'] = search_form.cleaned_data['fq']
     if search_form.cleaned_data['sort']:
@@ -70,6 +69,7 @@ def index(request):
 
     try:
       hue_collection = Collection.objects.get(id=collection_id)
+      solr_query['collection'] = hue_collection.name
       response = SolrApi(SOLR_URL.get()).query(solr_query, hue_collection)
     except Exception, e:
       error['message'] = unicode(str(e), "utf8")