merge correction
authorymh <ymh.work@gmail.com>
Mon, 13 May 2013 14:22:37 +0200
changeset 1181 6ab716dd58f8
parent 1180 54ef33bb4065
child 1183 d6cd3baa8b00
child 1187 73403060f297
merge correction
.settings/org.eclipse.core.resources.prefs
src/ldt/ldt/indexation/backends/elasticsearch_backend.py
--- a/.settings/org.eclipse.core.resources.prefs	Sat May 11 23:09:05 2013 +0200
+++ b/.settings/org.eclipse.core.resources.prefs	Mon May 13 14:22:37 2013 +0200
@@ -1,4 +1,3 @@
-#Mon Apr 08 17:07:34 CEST 2013
 eclipse.preferences.version=1
 encoding//src/ldt/ldt/core/migrations/0001_initial.py=utf-8
 encoding//src/ldt/ldt/core/migrations/0002_auto__del_owner.py=utf-8
@@ -38,6 +37,7 @@
 encoding//src/ldt/ldt/ldt_utils/migrations/0026_set_relative_ldtproject.py=utf-8
 encoding//src/ldt/ldt/ldt_utils/views/json.py=utf-8
 encoding//src/ldt/ldt/management/commands/synciri.py=utf-8
+encoding//src/ldt/ldt/management/commands/updateiriurlinprojects.py=utf-8
 encoding//src/ldt/ldt/management/utils.py=utf-8
 encoding//src/ldt/ldt/test/test_runner.py=utf-8
 encoding//src/ldt/ldt/text/migrations/0001_initial.py=utf-8
--- a/src/ldt/ldt/indexation/backends/elasticsearch_backend.py	Sat May 11 23:09:05 2013 +0200
+++ b/src/ldt/ldt/indexation/backends/elasticsearch_backend.py	Mon May 13 14:22:37 2013 +0200
@@ -60,70 +60,7 @@
         
         return kwargs
     
-    def _process_results(self, raw_results, highlight=False, result_class=None):
-        from haystack import connections
-        results = []
-        hits = raw_results.get('hits', {}).get('total', 0)
-        facets = {}
-        spelling_suggestion = None
-
-        if result_class is None:
-            result_class = SearchResult
-
-        if 'facets' in raw_results:
-            facets = {
-                'fields': {},
-                'dates': {},
-                'queries': {},
-            }
-
-            for facet_fieldname, facet_info in raw_results['facets'].items():
-                if facet_info.get('_type', 'terms') == 'terms':
-                    facets['fields'][facet_fieldname] = [(individual['term'], individual['count']) for individual in facet_info['terms']]
-                elif facet_info.get('_type', 'terms') == 'date_histogram':
-                    # Elasticsearch provides UTC timestamps with an extra three
-                    # decimals of precision, which datetime barfs on.
-                    facets['dates'][facet_fieldname] = [(datetime.datetime.utcfromtimestamp(individual['time'] / 1000), individual['count']) for individual in facet_info['entries']]
-                elif facet_info.get('_type', 'terms') == 'query':
-                    facets['queries'][facet_fieldname] = facet_info['count']
-
-        unified_index = connections[self.connection_alias].get_unified_index()
-        indexed_models = unified_index.get_indexed_models()
-
-        for raw_result in raw_results.get('hits', {}).get('hits', []):
-            source = raw_result['_source']
-            app_label, model_name = source[DJANGO_CT].split('.')
-            additional_fields = {}
-            model = get_model(app_label, model_name)
-
-            if model and model in indexed_models:
-                for key, value in source.items():
-                    index = unified_index.get_index(model)
-                    string_key = str(key)
-
-                    if string_key in index.fields and hasattr(index.fields[string_key], 'convert'):
-                        additional_fields[string_key] = index.fields[string_key].convert(value)
-                    else:
-                        additional_fields[string_key] = self.conn.to_python(value)
-
-                del(additional_fields[DJANGO_CT])
-                del(additional_fields[DJANGO_ID])
-
-                if 'highlight' in raw_result:
-                    additional_fields['highlighted'] = raw_result['highlight']
-
-                result = result_class(app_label, model_name, source[DJANGO_ID], raw_result['_score'], **additional_fields)
-                results.append(result)
-            else:
-                hits -= 1
-
-        return {
-            'results': results,
-            'hits': hits,
-            'facets': facets,
-            'spelling_suggestion': spelling_suggestion,
-        }
-        
+                
     def remove(self, obj_or_string, commit=True):
         
         if not self.setup_complete: