all repos — litestore @ 7ba455f7b23c2abd7f6b661e8d525d38b42a426a

A minimalist nosql document store.

Fixed sorting when search option is specified.
h3rald h3rald@h3rald.com
Sun, 12 Jan 2020 14:57:28 +0100
commit

7ba455f7b23c2abd7f6b661e8d525d38b42a426a

parent

8b59b78d5331a0981e60341bb854a422aa5d201b

1 files changed, 2 insertions(+), 1 deletions(-)

jump to
M src/litestorepkg/lib/utils.nimsrc/litestorepkg/lib/utils.nim

@@ -73,7 +73,8 @@ let rank = "rank(matchinfo(searchdata, 'pcxnal'), 1.20, 0.75, 5.0, 0.5) AS rank"

let snippet = "snippet(searchdata, \"<strong>\", \"</strong>\", \"<strong>&hellip;</strong>\", -1, 30) as highlight" options.select.add(snippet) options.select.add("ranktable.rank AS rank") - options.orderby = "rank DESC" + if (options.orderby == ""): + options.orderby = "rank DESC" # Create inner select var innerSelect = "SELECT docid, " & rank & " FROM searchdata WHERE searchdata MATCH '" & options.search.replace("'", "''") & "' " if options.tags.len > 0: