all repos — litestore @ 6063d66f8eaa094c31caa313990f088de4fc4ea3

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

6063d66f8eaa094c31caa313990f088de4fc4ea3

parent

d1edb8a63769ef0c5c56ccb47a51a1d176f7df8a

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: