Exemplo n.º 1
0
 def get_search_results(self, req, query, filters):
     if not 'ticket' in filters:
         return
     db = self.env.get_db_cnx()
     sql, args = query_to_sql(db, query, 'b.newvalue')
     sql2, args2 = query_to_sql(db, query, 'summary||keywords||description||reporter||cc')
     cursor = db.cursor()
     cursor.execute("SELECT DISTINCT a.summary,a.description,a.reporter, "
                    "a.keywords,a.id,a.time FROM ticket a "
                    "LEFT JOIN ticket_change b ON a.id = b.ticket "
                    "WHERE (b.field='comment' AND %s ) OR %s" % (sql, sql2),
                    args + args2)
     for summary,desc,author,keywords,tid,date in cursor:
         yield (self.env.href.ticket(tid),
                '#%d: %s' % (tid, util.shorten_line(summary)),
                date, author,
                shorten_result(desc, query.split()))
Exemplo n.º 2
0
 def get_search_results(self, req, query, filters):
     if not 'changeset' in filters:
         return
     authzperm = SubversionAuthorizer(self.env, req.authname)
     db = self.env.get_db_cnx()
     sql = "SELECT rev,time,author,message " \
           "FROM revision WHERE %s OR %s" % \
           (query_to_sql(db, query, 'message'),
            query_to_sql(db, query, 'author'))
     cursor = db.cursor()
     cursor.execute(sql)
     for rev, date, author, log in cursor:
         if not authzperm.has_permission_for_changeset(rev):
             continue
         yield (self.env.href.changeset(rev), '[%s]: %s' %
                (rev, util.escape(util.shorten_line(log))), date, author,
                util.escape(shorten_result(log, query.split())))
Exemplo n.º 3
0
 def get_search_results(self, req, query, filters):
     if not 'ticket' in filters:
         return
     db = self.env.get_db_cnx()
     sql = "SELECT DISTINCT a.summary,a.description,a.reporter, " \
           "a.keywords,a.id,a.time FROM ticket a " \
           "LEFT JOIN ticket_change b ON a.id = b.ticket " \
           "WHERE (b.field='comment' AND %s ) OR %s" % \
           (query_to_sql(db, query, 'b.newvalue'),
            query_to_sql(db, query, 'summary||keywords||description||reporter||cc'))
     cursor = db.cursor()
     cursor.execute(sql)
     for summary, desc, author, keywords, tid, date in cursor:
         yield (self.env.href.ticket(tid),
                '#%d: %s' % (tid, util.escape(util.shorten_line(summary))),
                date, author,
                util.escape(shorten_result(desc, query.split())))
Exemplo n.º 4
0
    def get_search_results(self, req, query, filters):
        if not 'wiki' in filters:
            return
        db = self.env.get_db_cnx()
        sql = "SELECT w1.name,w1.time,w1.author,w1.text " \
              "FROM wiki w1," \
              "(SELECT name,max(version) AS ver " \
              "FROM wiki GROUP BY name) w2 " \
              "WHERE w1.version = w2.ver AND w1.name = w2.name " \
              "AND (%s OR %s OR %s)" % \
              (query_to_sql(db, query, 'w1.name'),
               query_to_sql(db, query, 'w1.author'),
               query_to_sql(db, query, 'w1.text'))

        cursor = db.cursor()
        cursor.execute(sql)
        for name, date, author, text in cursor:
            yield (self.env.href.wiki(name),
                   '%s: %s' % (name, escape(shorten_line(text))), date, author,
                   escape(shorten_result(text, query.split())))
Exemplo n.º 5
0
 def get_search_results(self, req, query, filters):
     if not 'changeset' in filters:
         return
     authzperm = SubversionAuthorizer(self.env, req.authname)
     db = self.env.get_db_cnx()
     sql, args = query_to_sql(db, query, 'message||author')
     cursor = db.cursor()
     cursor.execute("SELECT rev,time,author,message "
                    "FROM revision WHERE " + sql, args)
     for rev, date, author, log in cursor:
         if not authzperm.has_permission_for_changeset(rev):
             continue
         yield (self.env.href.changeset(rev),
                '[%s]: %s' % (rev, util.shorten_line(log)),
                date, author, shorten_result(log, query.split()))
Exemplo n.º 6
0
    def get_search_results(self, req, query, filters):
        if not 'wiki' in filters:
            return
        db = self.env.get_db_cnx()
        sql_query, args = query_to_sql(db, query, 'w1.name||w1.author||w1.text')
        cursor = db.cursor()
        cursor.execute("SELECT w1.name,w1.time,w1.author,w1.text "
                       "FROM wiki w1,"
                       "(SELECT name,max(version) AS ver "
                       "FROM wiki GROUP BY name) w2 "
                       "WHERE w1.version = w2.ver AND w1.name = w2.name "
                       "AND " + sql_query, args)

        for name, date, author, text in cursor:
            yield (self.env.href.wiki(name),
                   '%s: %s' % (name, shorten_line(text)),
                   date, author,
                   shorten_result(text, query.split()))
Exemplo n.º 7
0
    def get_search_results(self, req, query, filters):
        if not "wiki" in filters:
            return
        db = self.env.get_db_cnx()
        sql_query, args = query_to_sql(db, query, "w1.name||w1.author||w1.text")
        cursor = db.cursor()
        cursor.execute(
            "SELECT w1.name,w1.time,w1.author,w1.text "
            "FROM wiki w1,"
            "(SELECT name,max(version) AS ver "
            "FROM wiki GROUP BY name) w2 "
            "WHERE w1.version = w2.ver AND w1.name = w2.name "
            "AND " + sql_query,
            args,
        )

        for name, date, author, text in cursor:
            yield (
                self.env.href.wiki(name),
                "%s: %s" % (name, shorten_line(text)),
                date,
                author,
                shorten_result(text, query.split()),
            )