Fix sorting by relevance
This commit is contained in:
parent
08fd243a20
commit
f69836ad09
@ -41,15 +41,18 @@ window.onload = function () {
|
||||
query = queryInput.value
|
||||
switch (sortDropdown.selectedIndex) {
|
||||
case 0:
|
||||
setOrderBy("RELEVANCE")
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
setOrderBy("TOTAL_SIZE")
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
setOrderBy("DISCOVERED_ON")
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
setOrderBy("N_FILES")
|
||||
break;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<!--suppress ALL -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
@ -30,6 +31,7 @@
|
||||
<div><a href="/"><b>magnetico<sup>w</sup></b></a>​<sub>(pre-alpha)</sub></div>
|
||||
<input id="query" type="search" name="query" placeholder="Search the BitTorrent DHT">
|
||||
<select id="sort-dropdown">
|
||||
<option value="size_asc">By relevance</option>
|
||||
<option value="size_asc">By size (ascending)</option>
|
||||
<option value="size_desc">By size (descending)</option>
|
||||
<option value="size_asc">By date (ascending)</option>
|
||||
|
@ -298,7 +298,7 @@ func (db *postgresDatabase) QueryTorrents(
|
||||
func orderOnPostgreSQL(orderBy OrderingCriteria) string {
|
||||
switch orderBy {
|
||||
case ByRelevance:
|
||||
return "relevance"
|
||||
return "similarity(name, 'twistys') * -1"
|
||||
|
||||
case ByTotalSize:
|
||||
return "total_size"
|
||||
|
Loading…
Reference in New Issue
Block a user