Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Unable to search for IP address in ticket body or title

Our tickets contain a lot of IP addresses in the body of the ticket, which we'd like to be able to search as new tickets are created. However, when a search is performed with an IP address known to be in a ticket, no results are returned.

I suspect this is more of a limitation of MySQL fulltext searching, but was hoping someone here has found a workaround/solution for this...?


  • I can confirm on my 1.9.7 that I cannot search for IP addresses either.
  • I can not search by any information in the body or subject of the ticket.  Any help would be greatly appreciated.


  • After a bit of digging, the search optimization is being silly, anything that is numeric (IP address, phone number) is assumed to be a ticket ID.

    After commenting out some lines in in the include/staff folder I got it to search just fine.

            $qs += array('query' => $searchTerm);
            $queryterm=db_real_escape($searchTerm,false); //escape the term quotes.
    //        if (is_numeric($searchTerm)) {
    //            $qwhere.=" AND ticket.`number` LIKE '$queryterm%'";
    //        } elseif (strpos($searchTerm,'@') && Validator::is_email($searchTerm)) {
                //pulling all tricks!
                # XXX: What about searching for email addresses in the body of
                #      the thread message
    //            $qwhere.=" AND email.address='$queryterm'";
    //        } else {//Deep search!
                //This sucks..mass scan! search anything that moves!

                $tickets = TicketsAjaxApi::_search(array('query'=>$queryterm));
                if (count($tickets)) {
                    $ticket_ids = implode(',',db_input($tickets));
                    $qwhere .= ' AND ticket.ticket_id IN ('.$ticket_ids.')';
                    $order_by = 'FIELD(ticket.ticket_id, '.$ticket_ids.')';
                    $order = ' ';
                    // No hits -- there should be an empty list of results
                    $qwhere .= ' AND false';
    //        }

    It's a bit dirty but works.
Sign In or Register to comment.