[dw-free] Highlight in subjects as well as content when searching
[commit: http://hg.dwscoalition.org/dw-free/rev/53b7f7d82aa3]
http://bugs.dwscoalition.org/show_bug.cgi?id=1847
Add subject highlighting in searches.
Patch by
the_wanlorn.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1847
Add subject highlighting in searches.
Patch by
Files modified:
- bin/worker/sphinx-search-gm
--------------------------------------------------------------------------------
diff -r 5aa38d807317 -r 53b7f7d82aa3 bin/worker/sphinx-search-gm
--- a/bin/worker/sphinx-search-gm Tue Jan 17 08:29:51 2012 +0000
+++ b/bin/worker/sphinx-search-gm Thu Jan 19 15:46:33 2012 +0800
@@ -124,6 +124,7 @@
# try to figure out the language of the journal being searched (or the searcher?) and use
# an appropriate stemming library? (future expansion opportunity)
my $exc = $sx->BuildExcerpts( [ map { $_->{entry} } @out ], 'dw1stemmed', $query, {} ) || [];
+ my $subj = $sx->BuildExcerpts( [ map { $_->{subject} } @out ], 'dw1stemmed', $query, {} ) || [];
# if we have a matching number of excerpts to events, then we can determine
# which one goes with which post.
@@ -131,6 +132,7 @@
foreach my $m ( @out ) {
delete $m->{entry};
$m->{excerpt} = shift @$exc;
+ $m->{subject} = shift @$subj;
}
} else {
--------------------------------------------------------------------------------
