Navigation Menu

Skip to content

Commit

Permalink
Set weight to Bookmarks#comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ongaeshi committed Nov 11, 2014
1 parent 3059cb0 commit b444964
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/honyomi/database.rb
Expand Up @@ -100,7 +100,12 @@ def search(query)
match_pages = @pages.select(query.page_query, default_column: "text")
snippet = match_pages.expression.snippet([["<span class=\"highlight\">", "</span>"]], {html_escape: true, normalize: true, max_results: 5})

match_bookmarks = @bookmarks.select(query.bookmark_query, default_column: "comment")
match_bookmarks = @bookmarks.select do |record|
record.match(query.bookmark_query) do |target|
target.comment * 10
end
end

group_by_page = match_bookmarks.group("page")

return group_by_page.union!(match_pages), snippet
Expand Down

0 comments on commit b444964

Please sign in to comment.