[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GMG-Devel] [PATCH 49/83] Show only unique results.
From: |
Alon Levy |
Subject: |
[GMG-Devel] [PATCH 49/83] Show only unique results. |
Date: |
Tue, 25 Feb 2014 21:58:31 +0200 |
From: Praveen Kumar <address@hidden>
---
mediagoblin/plugins/search/indices.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/mediagoblin/plugins/search/indices.py
b/mediagoblin/plugins/search/indices.py
index d62548b..b8003ca 100644
--- a/mediagoblin/plugins/search/indices.py
+++ b/mediagoblin/plugins/search/indices.py
@@ -24,10 +24,11 @@ class MediaEntrySearchIndex(SearchIndex):
'css_id': self.css_id,
'results': [],
}
+
+ obj_ids = set([result['id_stored'] for result in results])
+
search_results = []
- for result in results:
- _log.info(result)
- obj_id = result['id_stored']
+ for obj_id in obj_ids:
obj = self.model.query.get(obj_id)
search_results.append({
'slug': obj.slug,
@@ -35,8 +36,10 @@ class MediaEntrySearchIndex(SearchIndex):
})
all_results['results'] = search_results
+
_log.info("Found results ")
_log.info(all_results)
+
return all_results
@@ -59,9 +62,9 @@ class MediaTagSearchIndex(SearchIndex):
'css_id': self.css_id,
'results': [],
}
+ obj_ids = set([result['id_stored'] for result in results])
search_results = []
- for result in results:
- obj_id = result['id_stored']
+ for obj_id in obj_ids:
obj = self.model.query.get(obj_id)
media_entry_obj = MediaEntry.query.get(obj.media_entry)
search_results.append({
--
1.8.5.3
- [GMG-Devel] [PATCH 38/83] Add gmg command to delete all indices., (continued)
- [GMG-Devel] [PATCH 38/83] Add gmg command to delete all indices., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 39/83] Clean up and add docstring to search methods., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 40/83] Add try-except block to event listeners., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 42/83] Store attributes from a model only it its available., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 43/83] Add field for storing search results., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 41/83] Correct method names in event listeners, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 44/83] Remove the field for storing search results with the index., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 46/83] Add verbose_name and css_id to search results., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 47/83] Adapt results collection to change in result generation., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 48/83] Modify search template to show tabbed results., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 49/83] Show only unique results.,
Alon Levy <=
- [GMG-Devel] [PATCH 50/83] Change element ids and some template fixes., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 51/83] Change view function for the search page., Alon Levy, 2014/02/25