# HG changeset patch # User verrierj # Date 1327510621 -3600 # Node ID 8e9494006e7be0c1c560db2d429084fec769310b # Parent ff060d157dae3cef0c9b55773174b160661b8511 segment abstracts + content images can be retrieved directly from search results page diff -r ff060d157dae -r 8e9494006e7b src/ldt/ldt/indexation/__init__.py --- a/src/ldt/ldt/indexation/__init__.py Wed Jan 25 15:47:19 2012 +0100 +++ b/src/ldt/ldt/indexation/__init__.py Wed Jan 25 17:57:01 2012 +0100 @@ -46,30 +46,30 @@ return hits.scoreDocs -def highlight_documents(doc_list, query, field): +def highlight_documents(results_list, query, field): searcher = get_searcher() analyzer = lucene.FrenchAnalyzer(lucene.Version.LUCENE_CURRENT) formatter = lucene.SimpleHTMLFormatter('', '') query = get_query_parser(field).parse(query) highlighter = lucene.Highlighter(formatter, lucene.QueryScorer (query)) - for project in doc_list: + for project in results_list: for segment in project['list']: - lucene_doc = searcher.doc(segment['lucene_id']) - segment['context'] = get_highlighted_text(lucene_doc, analyzer, highlighter, 'abstract') + lucene_doc = searcher.doc(segment.lucene_id) + segment.context = get_highlighted_text(lucene_doc, analyzer, highlighter, 'abstract') tags = get_highlighted_text(lucene_doc, analyzer, highlighter, 'tags') - segment['title'] = get_highlighted_text(lucene_doc, analyzer, highlighter, 'title') + segment.title = get_highlighted_text(lucene_doc, analyzer, highlighter, 'title') - if segment['context'] == u'': - segment['context'] = lucene_doc.getField('abstract').stringValue() + if segment.context == u'': + segment.context = lucene_doc.getField('abstract').stringValue() if tags == u'': tags = lucene_doc.getField('tags').stringValue() - if segment['title'] == u'': - segment['title'] = lucene_doc.getField('title').stringValue() + if segment.title == u'': + segment.title = lucene_doc.getField('title').stringValue() - segment['tags'] = tags[tags.find(';')+1:] + segment.context_tags = tags[tags.find(';')+1:] - return doc_list + return results_list def get_highlighted_text(doc, analyzer, highlighter, field): res = doc.getField(field).stringValue() diff -r ff060d157dae -r 8e9494006e7b src/ldt/ldt/ldt_utils/templates/front/front_search_results.html --- a/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Wed Jan 25 15:47:19 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Wed Jan 25 17:57:01 2012 +0100 @@ -26,11 +26,9 @@ "segments" : [ {% for segment in res.list %} { "id" : '{{segment.element_id}}', - "begin" : {{segment.begin}}, + "begin" : {{segment.start_ts}}, "duration" : {{segment.duration}}, - "cutting_id" : '{{segment.decoupage_id}}', - "project_id" : '{{segment.project_id}}', - "ensemble_id" : '{{segment.ensemble_id}}', + "cutting_id" : '{{segment.cutting_id}}', },{% endfor %} ], "stats" : [{{ res.content.stat_annotation }}], @@ -38,7 +36,6 @@ ]; var global_csrf_token = "{{ csrf_token }}"; - var annot_preview_url = "{% url ldt.ldt_utils.views.front.annotation_preview project_id='__PROJECT_ID__' content_id='__CONTENT_ID__' ensemble_id='__ENSEMBLE_ID__' cutting_id='__CUTTING_ID__' segment_id='__SEGMENT_ID__' %}"; @@ -76,16 +73,16 @@
  • -

    {% if res.content_title|length > 20 %}{{res.content_title|capfirst|slice:"20"}}...{% else %}{{res.content_title}}{% endif %}

    +

    {% if res.content.title|length > 20 %}{{res.content.title|capfirst|slice:"20"}}...{% else %}{{res.content.title}}{% endif %}

    -

    {{res.content.duration|str_duration:"::"}}

    +

    {{res.content.duration|str_duration:"::" }}

    -
    + @@ -123,14 +120,13 @@ {{i|add:'1'}} {% endif %} {% if i|add:'1' < results.paginator.num_pages and 1 < results.paginator.num_pages %} - . {% endif %} {% endfor %} {% endif %} {% if results.has_next %} - . + {% trans "next" %} {% endif %}

    diff -r ff060d157dae -r 8e9494006e7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/search_results.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/search_results.html Wed Jan 25 15:47:19 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/search_results.html Wed Jan 25 17:57:01 2012 +0100 @@ -67,13 +67,13 @@