def find_words(self, query):
     db = self.env.get_read_db()
     sql, args = search_to_sql(db, ['filename', 'contents'], query)
     cursor = db.cursor()
     cursor.execute(self.query % sql, args)
     for id, filename, repo in cursor:
         yield filename, repo
예제 #2
0
 def search_tracforms(self, env, terms, cursor=None):
     """Backend method for TracForms ISearchSource implementation."""
     cursor = self.get_cursor(cursor)
     db = env.get_db_cnx()
     sql, args = search_to_sql(db, ['resource_id', 'subcontext', 'author',
                                    'state', db.cast('id', 'text')], terms)
     return cursor("""
         SELECT id,realm,resource_id,subcontext,state,author,time
         FROM forms
         WHERE %s
         """ % (sql), *args)
예제 #3
0
 def search_tracforms(self, env, terms, db=None):
     """Backend method for TracForms ISearchSource implementation."""
     db = self._get_db(db)
     cursor = db.cursor()
     sql, args = search_to_sql(db, ['resource_id', 'subcontext', 'author',
                                    'state', db.cast('id', 'text')], terms)
     cursor.execute("""
         SELECT id,realm,resource_id,subcontext,state,author,time
         FROM forms
         WHERE %s
         """ % sql, args)
     return cursor.fetchall()
예제 #4
0
 def search_tracforms(self, env, terms, cursor=None):
     """Backend method for TracForms ISearchSource implementation."""
     cursor = self.get_cursor(cursor)
     db = env.get_db_cnx()
     sql, args = search_to_sql(db, [
         'resource_id', 'subcontext', 'author', 'state',
         db.cast('id', 'text')
     ], terms)
     return cursor(
         """
         SELECT id,realm,resource_id,subcontext,state,author,time
         FROM forms
         WHERE %s
         """ % (sql), *args)
예제 #5
0
 def search_tracforms(self, env, terms, db=None):
     """Backend method for TracForms ISearchSource implementation."""
     db = self._get_db(db)
     cursor = db.cursor()
     sql, args = search_to_sql(db, [
         'resource_id', 'subcontext', 'author', 'state',
         db.cast('id', 'text')
     ], terms)
     cursor.execute(
         """
         SELECT id,realm,resource_id,subcontext,state,author,time
         FROM forms
         WHERE %s
         """ % sql, args)
     return cursor.fetchall()
예제 #6
0
    def get_search_results(self, req, terms, filters):
        """Return the entry  whose 'keyword' or 'text' tag contains
        one or more word among the terms.
        """

        if 'crashdump' not in filters:
            return

        self.log.debug('search for %s and %s', terms, filters)

        #ticket_realm = Resource(self.realm)
        with self.env.db_query as db:
            sql, args = search_to_sql(db, ['summary', 'keywords',
                                           'description', 'reporter', 'cc',
                                           'applicationname', 'applicationfile',
                                           'uploadhostname', 'uploadusername',
                                           'crashhostname', 'crashusername',
                                           'systemname',
                                           'uuid',
                                           db.cast('id', 'text')], terms)
            for id, uuid, summary, description, reporter, type, \
                crashhostname, crashusername, applicationname, applicationfile, systemname, \
                crashtime, reporttime, status, resolution in \
                    db("""SELECT id, uuid, summary, description, reporter, type,
                                 crashhostname, crashusername, applicationname, applicationfile, systemname,
                                 crashtime, reporttime, status, resolution
                          FROM crashdump
                          WHERE id IN (
                              SELECT id FROM crashdump WHERE %s
                          )
                          """ % (sql), args):
                if 'TICKET_VIEW' in req.perm:

                    # The events returned by this function must be tuples of the form (href, title, date, author, excerpt).
                    full_desc = '%s on %s (%s)' % (
                            applicationname if applicationname else applicationfile,
                            '%s@%s' % (crashusername, crashhostname),
                            systemname
                        )
                    #excerpt = shorten_result(full_desc, terms)
                    excerpt = full_desc
                    yield (req.href('crash', uuid),
                           tag_("%(title)s: %(uuid)s",
                                uuid=uuid,
                                title='CrashId#%i' % id,
                                ),
                           from_utimestamp(crashtime), reporter,
                           excerpt)
예제 #7
0
    def get_search_results(self, req, terms, filters):
        """Return the entry  whose 'keyword' or 'text' tag contains
        one or more word among the terms.
        """

        if 'crashdump' not in filters:
            return

        self.log.debug('search for %s and %s', terms, filters)

        #ticket_realm = Resource(self.realm)
        with self.env.db_query as db:
            sql, args = search_to_sql(db, ['summary', 'keywords',
                                           'description', 'reporter', 'cc',
                                           'applicationname', 'applicationfile',
                                           'uploadhostname', 'uploadusername',
                                           'crashhostname', 'crashusername',
                                           'systemname',
                                           'uuid',
                                           db.cast('id', 'text')], terms)
            for id, uuid, summary, description, reporter, type, \
                crashhostname, crashusername, applicationname, applicationfile, systemname, \
                crashtime, reporttime, status, resolution in \
                    db("""SELECT id, uuid, summary, description, reporter, type,
                                 crashhostname, crashusername, applicationname, applicationfile, systemname,
                                 crashtime, reporttime, status, resolution
                          FROM crashdump
                          WHERE id IN (
                              SELECT id FROM crashdump WHERE %s
                          )
                          """ % (sql), args):
                if 'TICKET_VIEW' in req.perm:

                    # The events returned by this function must be tuples of the form (href, title, date, author, excerpt).
                    full_desc = '%s on %s (%s)' % (
                            applicationname if applicationname else applicationfile,
                            '%s@%s' % (crashusername, crashhostname),
                            systemname
                        )
                    #excerpt = shorten_result(full_desc, terms)
                    excerpt = full_desc
                    yield (req.href('crash', uuid),
                           tag_("%(title)s: %(uuid)s",
                                uuid=uuid,
                                title='CrashId#%i' % id,
                                ),
                           from_utimestamp(crashtime), reporter,
                           excerpt)