From 42deb3c4599e745d9000b5684b408e02ddce987a Mon Sep 17 00:00:00 2001 From: Arne Georg Gleditsch Date: Wed, 12 Dec 2007 11:57:18 +0100 Subject: Sort ident searches the right way around, make sure local/member var results don't drown out more significant hits when limit kicks in. --- cgi-bin/lxr | 4 ++-- lib/LXRng/Index/DBI.pm | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cgi-bin/lxr b/cgi-bin/lxr index 719bf96..b134738 100755 --- a/cgi-bin/lxr +++ b/cgi-bin/lxr @@ -339,8 +339,8 @@ sub search { $ver, $find); my @cooked = (map { $$_[1] = ucfirst($LXRng::Lang::deftypes{$$_[1]}); $_ } - sort { $LXRng::Lang::defweight{$$a[1]} cmp - $LXRng::Lang::defweight{$$b[1]} || + sort { $LXRng::Lang::defweight{$$b[1]} cmp + $LXRng::Lang::defweight{$$a[1]} || $$a[2] cmp $$b[2] || $$a[3] <=> $$b[3] } @$result); diff --git a/lib/LXRng/Index/DBI.pm b/lib/LXRng/Index/DBI.pm index f22ebab..667530d 100644 --- a/lib/LXRng/Index/DBI.pm +++ b/lib/LXRng/Index/DBI.pm @@ -278,14 +278,23 @@ sub _identifiers_by_name { my $pre = $self->prefix; my $sth = $$self{'sth'}{'_identifiers_by_name'} ||= $dbh->prepare(qq{ - select i.id, i.type, f.path, i.line, i.id_rfile + (select i.id, i.type, f.path, i.line, i.id_rfile from ${pre}identifiers i, ${pre}files f, ${pre}filereleases r, ${pre}revisions v where i.id_rfile = v.id and v.id = r.id_rfile and r.id_release = ? and v.id_file = f.id - and i.id_symbol = ? limit 500}); + and i.type != 'm' and i.type != 'l' + and i.id_symbol = ? limit 250) + union + (select i.id, i.type, f.path, i.line, i.id_rfile + from ${pre}identifiers i, ${pre}files f, + ${pre}filereleases r, ${pre}revisions v + where i.id_rfile = v.id and v.id = r.id_rfile + and r.id_release = ? and v.id_file = f.id + and (i.type = 'm' or i.type = 'l') + and i.id_symbol = ? limit 250)}); - $sth->execute($rel_id, $sym_id); + $sth->execute($rel_id, $sym_id, $rel_id, $sym_id); my $res = $sth->fetchall_arrayref(); return $res; -- cgit v1.2.3