Comment 1 for bug 634449

Revision history for this message
Michael Vogt (mvo) wrote : Re: Searching for "lib" crashes Ubuntu Software Center

The problem is that the query parser can generate way too big querries, for lib its a 5000 entry long query. One possible fix is this, or we can limit it in appview.py and use the number there as a estimate for the amount of hits we probably get.

=== modified file 'softwarecenter/db/database.py'
--- softwarecenter/db/database.py 2010-08-20 13:06:38 +0000
+++ softwarecenter/db/database.py 2010-09-09 21:16:30 +0000
@@ -198,6 +198,12 @@
         fuzzy_query = self.xapian_parser.parse_query(search_term,
                                                xapian.QueryParser.FLAG_PARTIAL|
                                                xapian.QueryParser.FLAG_BOOLEAN)
+ # if the query size goes out of hand, omit the FLAG_PARTIAL
+ # (LP: #634449)
+ if fuzzy_query.get_length() > 1000:
+ fuzzy_query = self.xapian_parser.parse_query(
+ search_term, xapian.QueryParser.FLAG_BOOLEAN)
+ # now add categories
         fuzzy_query = _add_category_to_query(fuzzy_query)
         return [pkg_query,fuzzy_query]