====== Find Similar Tickets Feature ====== Author: Michelle McCausland ===== Introduction ===== The find similar tickets feature is used in the Ticketer application to identify ticket summaries that contain the same hub_name or ne_name and that are in the same market. ---- ===== How to access this feature ===== The find similar tickets feature can be accessed from the Ticketer search results page. Right-click on a ticket row and choose "Find similar tickets": {{ :onboarding:ticketer:find_similar_tickets.png?nolink |}} ---- ===== How this feature works ===== The code that executes this feature is found in **TicketQueryResults.java** in a method called **findSimilarTickets()**. - The search will begin by trying to gather the hub_name from the NOC form. - If there is no NOC form it will try to gather the ne_name field from the SNMP Trap form. - If there is no SNMP Trap form it will try to gather the hub_name from the Change Request form. - If an element name is found, it then creates a similar ticket search and sets a few things for the query, namely: * Summary: Tell the search to match the retrieved hub_name or ne_name in the ticket summary. * Markets: Restricts results to the same market as the source ticket. * Open Tickets: This will only return similar open tickets. - It then runs a query as normal. The only caveat is that, at query execution: the 'start date' of the search is forced to the year 2000. ---- ===== Here is an example of the query running ===== SELECT this_.id AS id101_2_, this_.version AS version101_2_, this_.actual_effort AS actual3_101_2_, this_.closed_date AS closed4_101_2_, this_.create_date AS create5_101_2_, this_.creator_id AS creator6_101_2_, this_.current_status_id AS current7_101_2_, this_.downtime_in_seconds AS downtime8_101_2_, this_.due_date AS due9_101_2_, this_.estimated_effort AS estimated10_101_2_, this_.is_dig_ticket AS is11_101_2_, this_.last_open_date AS last12_101_2_, this_.last_open_user_id AS last13_101_2_, this_.maintenance_id AS mainten14_101_2_, this_.parent_id AS parent15_101_2_, this_.priority AS priority101_2_, this_.rank AS rank101_2_, this_.summary AS summary101_2_, this_.type AS type101_2_, this_.updated_date AS updated20_101_2_, this_.visibility AS visibility101_2_, this_.workflow_id AS workflow22_101_2_, c1_.ticket_id AS ticket9_101_4_, c1_.id AS id4_, c1_.id AS id87_0_, c1_.version AS version87_0_, c1_.active AS active87_0_, c1_.changed_by_id AS changed4_87_0_, c1_.contents AS contents87_0_, c1_.date_added AS date6_87_0_, c1_.form_id AS form7_87_0_, c1_.header AS header87_0_, c1_.ticket_id AS ticket9_87_0_, c1_.updated_by_id AS updated10_87_0_, c1_.updated_date AS updated11_87_0_, logentries2_.ticket_id AS ticket6_101_5_, logentries2_.id AS id5_, logentries2_.id AS id22_1_, logentries2_.version AS version22_1_, logentries2_.contents AS contents22_1_, logentries2_.date AS date22_1_, logentries2_.entered_by_id AS entered5_22_1_, logentries2_.ticket_id AS ticket6_22_1_ FROM ticket this_ LEFT OUTER JOIN ticket_change c1_ ON this_.id = c1_.ticket_id LEFT OUTER JOIN log_entry logentries2_ ON this_.id = logentries2_.ticket_id WHERE (this_.parent_id IS NULL AND this_.create_date BETWEEN '2000-02-01 00:00:00' AND '2017-11-28 23:59:59' AND this_.visibility IN ('NV - T-Mobile') AND this_.maintenance_id IS NULL AND this_.closed_date IS NULL AND this_.is_dig_ticket = 0 AND (this_.summary LIKE '%SW-NV-LVSTRI-TMO%' OR (c1_.header LIKE '%SW-NV-LVSTRI-TMO%' OR c1_.contents LIKE '%SW-NV-LVSTRI-TMO%') OR (logentries2_.contents LIKE '%SW-NV-LVSTRI-TMO%')))