Skip to content
  • Alex Vandiver's avatar
    Improve != and NOT LIKE searching in combination with LargeContent · 8ee88206
    Alex Vandiver authored
    When attempting to perform a NOT LIKE (or != with a long value) on a
    single-value CF, the search is limited by:
    
      Content NOT LIKE '%value%' OR
      ((Content = '' OR Content IS NULL) AND LargeContent NOT LIKE '%value%')
    
    However, it must also be open to the possibility that the ticket did not
    contain a value for that CF, which is a valid method of having
    not-that-value.  It thus also added the possibility for lack-of-value by
    further limiting by:
    
       OR Content IS NULL
    
    Unfortunately, as Content is nearly definitionally NULL for rows with
    LargeContent, this results in a false positives where LargeContent
    matches '%value%' and thus the ticket should not match.
    
    The limitation of "or the ticket could fail to have a value for the CF"
    is better stated by checking that OCFV.id IS NULL, rather than
    OCFV.Content IS NULL; switch to this to avoid the false positive.  Note
    that $column cannot be defined at this point, as it has previously been
    checked for truth, and return'd already in such cases, so the removing
    the reference to $column is intentional.
    8ee88206