allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [34/38] git commit: [#4019] ticket:579 Remove wrong facet results filtering
Date Wed, 30 Apr 2014 18:16:06 GMT
[#4019] ticket:579 Remove wrong facet results filtering


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/1c889ca1
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/1c889ca1
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/1c889ca1

Branch: refs/heads/master
Commit: 1c889ca1c19f8b4d414b12b8b493044b2a8f9669
Parents: cafe937
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Mon Apr 28 14:35:02 2014 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Apr 30 15:55:15 2014 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py |  4 ++--
 ForgeTracker/forgetracker/search.py       | 20 +++-----------------
 2 files changed, 5 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/1c889ca1/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index bdf4e2e..847b814 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -1193,7 +1193,7 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
         return dict(tickets=tickets,
                     count=count, q=q, limit=limit, page=page, sort=sort,
                     filter=filter,
-                    filter_choices=tsearch.get_facets(matches, tickets),
+                    filter_choices=tsearch.get_facets(matches),
                     solr_error=solr_error, **kw)
 
     @classmethod
@@ -1215,7 +1215,7 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
             t = cls.query.find().first()
             if t:
                 search_query = cls.translate_query(search_query, t.index())
-            result['filter_choices'] = tsearch.query_filter_choices(search_query, result['tickets'])
+            result['filter_choices'] = tsearch.query_filter_choices(search_query)
         else:
             result = cls.paged_search(app_config, user, search_query, filter=filter,
                                       sort=solr_sort, limit=limit, page=page, **kw)

http://git-wip-us.apache.org/repos/asf/allura/blob/1c889ca1/ForgeTracker/forgetracker/search.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/search.py b/ForgeTracker/forgetracker/search.py
index e0ed81a..78181b8 100644
--- a/ForgeTracker/forgetracker/search.py
+++ b/ForgeTracker/forgetracker/search.py
@@ -28,12 +28,11 @@ FACET_PARAMS = {
 }
 
 
-def query_filter_choices(arg=None, final_obj_list=None):
+def query_filter_choices(arg=None):
     """
     Makes solr query and returns facets for tickets.
 
     :param arg: solr query, string
-    :param final_obj_list: final list of tickets
     """
     params = {
         'short_timeout': True,
@@ -46,32 +45,19 @@ def query_filter_choices(arg=None, final_obj_list=None):
     }
     params.update(FACET_PARAMS)
     result = search(arg, **params)
-    return get_facets(result, final_obj_list)
+    return get_facets(result)
 
 
-def get_facets(solr_hit, final_obj_list=None):
+def get_facets(solr_hit):
     """
     Filter and reshape facets for given solr result.
 
-    If you want to retrieve facets for only a subset of solr results, you
-    can pass this subset as ``final_obj_list``.
-
     :param solr_hit: solr result instance.
-    :param final_obj_list: final list of objects facets should be filtered on.
     """
     result = {}
     if solr_hit is not None:
         for facet_name, values in solr_hit.facets['facet_fields'].iteritems():
             field_name = facet_name.rsplit('_s', 1)[0]
             values = [(values[i], values[i+1]) for i in xrange(0, len(values), 2)]
-            if final_obj_list:
-                available_values = []
-                for obj in final_obj_list:
-                    solr_data = obj.index()
-                    if facet_name in solr_data:
-                        available_values.append(solr_data[facet_name])
-
-                values = filter(lambda v: v[0] in available_values, values)
-
             result[field_name] = values
     return result


Mime
View raw message