Add tracker searches

This commit is contained in:
Luminarys 2018-03-14 00:22:56 -07:00
parent 283df753c5
commit ed1c0a21f8
2 changed files with 7 additions and 1 deletions

View File

@ -27,7 +27,10 @@ export function search_criteria(text) {
} }
const [field, value] = t.split(op); const [field, value] = t.split(op);
if (op == ":") { if (op == ":") {
return { op: "ilike", field, value: `%${t}%` }; if (field == "tracker") {
return { op: "has", field: "tracker_urls", value };
}
return { op: "ilike", field, value };
} }
if (!isNaN(numeral(value).value())) { if (!isNaN(numeral(value).value())) {
return { return {

View File

@ -28,7 +28,9 @@ function SearchHelp(props) {
"throttle_down": "throttle down in bits/sec", "throttle_down": "throttle down in bits/sec",
"transferred_up": "total transfer up in bits/sec", "transferred_up": "total transfer up in bits/sec",
"transferred_down": "total transfer down in bits/sec", "transferred_down": "total transfer down in bits/sec",
"tracker": "tracker url",
"peers": "number of peers", "peers": "number of peers",
"trackers": "number of trackers",
"files": "number of files", "files": "number of files",
}; };
@ -70,6 +72,7 @@ function SearchHelp(props) {
<li>{searchLink("files>1")}</li> <li>{searchLink("files>1")}</li>
<li>{searchLink("files==1")}</li> <li>{searchLink("files==1")}</li>
<li>{searchLink("progress<0.1")}</li> <li>{searchLink("progress<0.1")}</li>
<li>{searchLink("tracker:archlinux.org")}</li>
</ul> </ul>
</div> </div>
); );