#2530: Search doesn't work on custom fields
---------------------------------+------------------------------------------
 Reporter:  [EMAIL PROTECTED]    |        Owner:  jonas
     Type:  defect               |       Status:  new  
 Priority:  normal               |    Milestone:       
Component:  search system        |      Version:  0.9b2
 Severity:  normal               |   Resolution:       
 Keywords:  custom field search  |  
---------------------------------+------------------------------------------
Comment (by jwin):

 this workes for me:

 '''excerpt from .../trac/ticket/api.py'''

 {{{
 ...
         sql2, args2 = query_to_sql(db, query,
 'summary||keywords||description||reporter||ltc||cc')
         cursor = db.cursor()
         cursor.execute("SELECT DISTINCT
 a.summary,a.description,a.reporter, "
                        "a.keywords,a.id,a.time,c.value as ltc FROM ticket
 a "
                        "LEFT JOIN ticket_change b ON a.id = b.ticket "
                        "LEFT OUTER JOIN ticket_custom c ON (a.id =
 c.ticket AND c.name = 'ltc') "
                        "WHERE (b.field='comment' AND %s ) OR %s" % (sql,
 sql2),
                        args + args2)
         for summary,desc,author,keywords,tid,date,ltc in cursor:
 ...
 }}}

 notice the occurrence of "ltc", which is my custom ticket field that
 should be searched for the query string

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2530>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets

Reply via email to