Merge pull request #45 from Luminarys/master

Add tracker searches
This commit is contained in:
Drew DeVault 2018-03-14 08:33:15 -04:00 committed by GitHub
commit b27e49d57f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 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",
}; };
@ -64,12 +66,13 @@ function SearchHelp(props) {
Here are some example searches: Here are some example searches:
</p> </p>
<ul> <ul>
<li>{searchLink("state:seeding")}</li> <li>{searchLink("status:seeding")}</li>
<li>{searchLink("state:leeching")}</li> <li>{searchLink("status:idle")}</li>
<li>{searchLink("rate_up>1048576")}</li> <li>{searchLink("rate_up>1048576")}</li>
<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>
); );