diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 508e2e81..61765f49 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -533,7 +533,7 @@ def run_argparse(argv, formatter): ap2.add_argument("--no-idx", metavar="PTN", type=u, help="regex: disable indexing of matching paths during e2ds folder scans") ap2.add_argument("--re-maxage", metavar="SEC", type=int, default=0, help="disk rescan volume interval, 0=off, can be set per-volume with the 'scan' volflag") ap2.add_argument("--srch-time", metavar="SEC", type=int, default=30, help="search deadline") - ap2.add_argument("--srch-hits", metavar="N", type=int, default=1000, help="max search results") + ap2.add_argument("--srch-hits", metavar="N", type=int, default=7999, help="max search results") ap2 = ap.add_argument_group('metadata db options') ap2.add_argument("-e2t", action="store_true", help="enable metadata indexing") diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 54bb6c35..6a4600c4 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -875,8 +875,9 @@ class HttpCli(object): else: # search by query params q = body["q"] - self.log("qj: " + q) - hits, taglist = idx.search(vols, q) + n = body.get("n", self.args.srch_hits) + self.log("qj: {} |{}|".format(q, n)) + hits, taglist = idx.search(vols, q, n) msg = len(hits) idx.p_end = time.time() diff --git a/copyparty/u2idx.py b/copyparty/u2idx.py index bafa8203..566bb146 100644 --- a/copyparty/u2idx.py +++ b/copyparty/u2idx.py @@ -55,7 +55,7 @@ class U2idx(object): uv = [wark[:16], wark] try: - return self.run_query(vols, uq, uv, True, False)[0] + return self.run_query(vols, uq, uv, True, False, 99999)[0] except: raise Pebkac(500, min_ex()) @@ -80,7 +80,7 @@ class U2idx(object): self.cur[ptop] = cur return cur - def search(self, vols, uq): + def search(self, vols, uq, lim): """search by query params""" if not HAVE_SQLITE3: return [] @@ -222,11 +222,11 @@ class U2idx(object): q += " lower({}) {} ? ) ".format(field, oper) try: - return self.run_query(vols, q, va, have_up, have_mt) + return self.run_query(vols, q, va, have_up, have_mt, lim) except Exception as ex: raise Pebkac(500, repr(ex)) - def run_query(self, vols, uq, uv, have_up, have_mt): + def run_query(self, vols, uq, uv, have_up, have_mt, lim): done_flag = [] self.active_id = "{:.6f}_{}".format( time.time(), threading.current_thread().ident @@ -255,7 +255,7 @@ class U2idx(object): self.log("qs: {!r} {!r}".format(uq, uv)) ret = [] - lim = int(self.args.srch_hits) + lim = min(lim, int(self.args.srch_hits)) taglist = {} for (vtop, ptop, flags) in vols: cur = self.get_cur(ptop) @@ -278,7 +278,7 @@ class U2idx(object): for hit in c: w, ts, sz, rd, fn, ip, at = hit[:7] lim -= 1 - if lim <= 0: + if lim < 0: break if rd.startswith("//") or fn.startswith("//"): diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 248d2a29..5c154d0d 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -460,6 +460,9 @@ html.y #files tr:nth-child(2n+1) td+td { #files thead th[style] { width: auto !important; } +#files .srch_hdr a { + display: inline; +} #path a { margin: 0 0 0 -.2em; padding: 0 0 0 .4em; diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 5082cc77..4db3879a 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -2861,12 +2861,17 @@ var thegrid = (function () { ths[a].className = cl; } - var uns = QS('#ggrid a[ref="unsearch"]'); - if (uns) - uns.onclick = function (e) { - ev(e); - ebi('unsearch').click(); - }; + + var sp = ['unsearch', 'moar']; + for (var a = 0; a < sp.length; a++) + (function (a) { + var o = QS('#ggrid a[ref="' + sp[a] + '"]'); + if (o) + o.onclick = function (e) { + ev(e); + ebi(sp[a]).click(); + }; + })(a); }; r.tippen = function () { @@ -3284,7 +3289,8 @@ document.onkeydown = function (e) { var trs = [], orig_url = null, - orig_html = null; + orig_html = null, + cap = 125; for (var a = 0; a < sconf.length; a++) { var html = ['