Skip to content
Snippets Groups Projects
  1. Oct 30, 2019
    • JediKev's avatar
      orm: Refetch Failure · eb4bda84
      JediKev authored
      This addresses an ORM failure where upon refetching an object from the
      database that no longer exists the system crashes hard. We use the `one()`
      method which expects one result, if there is no result it throws a
      `DoesNotExist` exception. We are not catching the exception properly which
      crashes osTicket and forces you to clear the session via browser or
      database.
      eb4bda84
  2. Apr 22, 2019
  3. Oct 22, 2018
    • Peter Rotich's avatar
      ORM: Extra Joins · fb582e4e
      Peter Rotich authored
      This commits adds ability to add extra joins to a queryset. If the join has
      constraints then it's LEFT joined otherwise straight JOIN is assumed.
      
      This is necessary to fix queue counts for queues with keyword search.
      fb582e4e
    • Jared Hancock's avatar
      search: Refactor full-text search · a9c283ec
      Jared Hancock authored
      This patch adds a few changes. First, the full-text search query is
      refactored so that MySQL can focus first on finding matching records in
      its full-text search index (in the %_search table) in a subquery. Then
      it can focus on matching records against tickets in an outer query
      (whether ticket data, thread entries, user info, or organization inf was
      matched).  This dramatically speeds up the query for large datasets by
      about 20x (about three seconds instead of sixty-something).
      
      Secondly, results are now sorted based on relevance, so the best hits
      sort a the top of the list. This is accomplished by adding the
      `relevance` to the query sort list via the extra() method. Then, since
      no GROUP BY clause is really necessary, it is not added to the query,
      which will allow the results not to be re-sorted by the ticket_id. (That
      is, the remain sorted by the search relevance).
      
      Third, the relevance has a lower limit of 0.3. Good hits seem to have a
      much larger value (like hundreds), so setting a small value will help to
      remove hits with barely any relevance to the search terms.
      a9c283ec
    • Jared Hancock's avatar
      queue: Use nested criteria for the query · 81b1e9d7
      Jared Hancock authored
      This changes the organization of the ticket queue query. It places the criteria of
      the queue and the access criteria based on the staff in a query by itself. Then it
      joins to that query and selects the columns and annotations in the outer query.
      
      This seems to help MySQL focus on the query in two stages. The first is to find the
      one page of results to be shown on the page, and the second is to find all the
      information to be shown for each ticket.
      81b1e9d7
    • Jared Hancock's avatar
      orm: not every query needs a group by clause · f602cba3
      Jared Hancock authored
      If there are annotations in an SQL statement, but there are no aggregate
      functions used (such as SUM, COUNT, etc), then a GROUP BY clause is not
      technically required. Using one implies sorting of the results to ensure
      uniqueness--prior to sorting them according to the requested sort in the ORDER
      BY clause.
      f602cba3
    • Jared Hancock's avatar
      queue: Add MySQL index hint · 0801ef01
      Jared Hancock authored
      This adds the advanced option to the queue sort configuration. An index can be
      specified to be used for the sorting operation. In some cases, the MySQL query
      optimizer cannot select the most efficient index to use when dealing with large
      querysets and sorting. This feature, if enabled, allows an administrator to specify
      an index which MySQL should use when using the sort.
      
      To use the feature, an `extra` column must be added to the `%queue_sort` table to
      receive the index name.
      0801ef01
  4. Sep 05, 2018
  5. Aug 28, 2018
  6. Jul 06, 2018
  7. May 15, 2018
    • Jared Hancock's avatar
      queryset: Fix circular reference error · e657a33e
      Jared Hancock authored
      This fixes an error where the ModelInstanceManager maintained a reference to
      the QuerySet instance, and the QuerySet instance managed a reference to the
      ModelInstanceManager instance (if it's the iterator for the query). Because
      of the circular reference, if the iterator is not exhausted, then the
      resource is not closed and the query remains open. This wastes memory and
      prevents some other queries from running after such a situation happens.
      
      This addresses the issue by removing the circular reference between the
      QuerySet and the ModelInstanceManager.
      e657a33e
  8. May 02, 2018
  9. Apr 19, 2018
    • Jared Hancock's avatar
      queryset: Fix circular reference error · 0f9cab06
      Jared Hancock authored
      This fixes an error where the ModelInstanceManager maintained a reference to
      the QuerySet instance, and the QuerySet instance managed a reference to the
      ModelInstanceManager instance (if it's the iterator for the query). Because
      of the circular reference, if the iterator is not exhausted, then the
      resource is not closed and the query remains open. This wastes memory and
      prevents some other queries from running after such a situation happens.
      
      This addresses the issue by removing the circular reference between the
      QuerySet and the ModelInstanceManager.
      0f9cab06
  10. Mar 22, 2018
  11. Mar 12, 2018
  12. Oct 30, 2017
Loading