aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Georg Gleditsch <argggh@lxr.linpro.no>2007-12-12 11:57:18 +0100
committerArne Georg Gleditsch <argggh@lxr.linpro.no>2007-12-12 11:57:18 +0100
commit42deb3c4599e745d9000b5684b408e02ddce987a (patch)
tree8735d2571e59cab71bc56cb154bb994032148235
parent1379bdb6e5b40d205ba92fc1a3747d70094a05d9 (diff)
Sort ident searches the right way around, make sure local/member var results don't drown out more significant hits when limit kicks in.
-rwxr-xr-xcgi-bin/lxr4
-rw-r--r--lib/LXRng/Index/DBI.pm15
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;