Results 1 to 5 of 5

Thread: List view searches and %

  1. #1
    dseaton is offline Sugar Community Member
    Join Date
    Jan 2006
    Posts
    10

    Cool List view searches and %

    From the Sugar Open Source User and Administrator Guide Version 4.2 March 2006
    I read the following...
    List view searches
    When working with the list view, you can work with the complete list, or use the search filter to reduce
    it to a more manageable size. To use the search filter, type in one or more boxes and then click on
    the Search button. Text entered in search fields needs to match from the beginning of the value
    stored in each record – for example “fred” will match Frederick, but not Alfred, in a first name field. If
    text is entered in more than one search field, then a record must match on all those fields to be
    included in the filtered list. Wild card search characters are not needed and not supported. In other
    words, searching for “fred*” would only match first names like “Fred*erick” or other “Fred” names
    containing the asterisk (*) character.

    It make it very hard to search for some things when the value in the record is "the tool" and you need to search for tool.
    we almost dropped sugar because we couldn't search our existing data well enough.

    Then we discovered that if you enter %tool it will find tool in "the tool" and if you enter %fred it will find Alfred.
    Maybe I missed something somewhere or this is a well known search method but it would help if it was documented.
    I hope this helps someone else learn about it.

  2. #2
    JohnnyB is offline Sugar Community Member
    Join Date
    Aug 2006
    Location
    Battle Ground, WA (USA)
    Posts
    22

    Default Re: List view searches and %

    Man, thank you sooo much! We couldn't figure this out. Granted I spent about five minutes on it unil I came to the forums.

    This was VERY helpful though. I dont know how we would've been able to use it without this.

  3. #3
    richardk@idealogical.com is offline Sugar Community Member
    Join Date
    Jun 2006
    Posts
    23

    Default Re: List view searches and %

    It's not documented anywhere as far as I know, but in actuality it's not a feature of Sugar, but of the db/MySQL as I mention in here:

    http://www.sugarcrm.com/forums/showthread.php?t=15289

    From what I can tell, the searches in Sugar are done as a "LIKE" -- ... WHERE foo LIKE 'value%' AND bar LIKE 'value2%' ...

    The % wildcard is being tacked on in the query, so when you yourself add a leading % in a search, it turns out as ... WHERE foo LIKE '%value%' AND bar LIKE '%value2%' ...

    I was happy too when I discovered that, but in my case I'm searching for a way to suppress it :S

  4. #4
    richardk@idealogical.com is offline Sugar Community Member
    Join Date
    Jun 2006
    Posts
    23

    Default Re: List view searches and %

    Just an update if you were interested -- I've tracked it down and confirmed what I figured -- it does indeed tack on %'s for LIKE's in a WHERE clause.

    If it's any use to someone, In the thread I linked to in the previous message, I've updated and detailed my modifications on how to strip any user-inputted leading %'s to basically force it into Sugars originally-intended search method.

  5. #5
    Bart.Steanes is offline Junior Member
    Join Date
    Jun 2006
    Posts
    1

    Default Re: List view searches and %

    I'd appreciate an explanation of how to do this, and in addition, how to remove the "implicit" trailing %.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •