Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Stop using suffix matching for direct-result qualified-type queries.

This ought to make them much faster, as they'll be able to use the index (assuming the collation is case insensitive, which I'm not sure about). They're covered by the test I added in the previous commit. I've jazzed it up to check case-insensitivity, which may or may not be desired. For now, I'm playing it safe.
  • Loading branch information...
commit 0dba18d70a432c4b7009b5f0109f173cff609065 1 parent 521ad0e
Erik Rose erikrose authored
Showing with 7 additions and 7 deletions.
  1. +1 −1  dxr/query.py
  2. +6 −6 tests/test_direct.py
2  dxr/query.py
View
@@ -249,7 +249,7 @@ def direct_result(self):
(SELECT path FROM files WHERE files.id = types.file_id) as path,
types.file_line
FROM types WHERE types.qualname LIKE ? LIMIT 2
- """, ("%" + term,))
+ """, (term,))
rows = cur.fetchall()
if rows and len(rows) == 1:
return (rows[0]['path'], rows[0]['file_line'])
12 tests/test_direct.py
View
@@ -29,11 +29,11 @@ def direct_result_eq(self, query_text, line_num):
eq_(Query(conn, query_text).direct_result(), ('main.cpp', line_num))
def test_qualified_function_name_prefix(self):
- """A unique prefix match on fully qualified function name should take
- you directly to the result."""
- self.direct_result_eq('MemberFunction::member_function', 12)
+ """A unique, case-insensitive prefix match on fully qualified function
+ name should take you directly to the result."""
+ self.direct_result_eq('MemberFunction::member_FUNCTION', 12)
def test_qualified_type_name(self):
- """A unique prefix match on fully qualified type name should take you
- directly to the result."""
- self.direct_result_eq('MemberFunction::InnerClass', 8)
+ """A unique, case-insensitive prefix match on fully qualified type name
+ should take you directly to the result."""
+ self.direct_result_eq('MemberFunction::InnerCLASS', 8)
Please sign in to comment.
Something went wrong with that request. Please try again.