Search fast in NSDictionary

  • I'm searching a function to search within a string of an NSDictionary
    fast as iTunes search method.

    Any idea?
    How can I use Hashing for it?

    Thanks
  • On Oct 23, 2006, at 6:16 AM, xidiar wrote:

    > I'm searching a function to search within a string of an
    > NSDictionary fast as iTunes search method.
    >
    > Any idea?
    > How can I use Hashing for it?

    One way of accomplishing this is to obtain an array of either the
    keys or values (depending on which components of the dictionary you
    want to search through) and filter that array using a predicate.

    So, call either [dict allValues] or [dict allKeys] and then use
    NSArray's filteredArrayUsingPredicate: to return an new array
    containing objects that match the search term.

    This is just one (10.4+) method of doing this.  It's probably the
    easiest, but maybe performance stands to gain using another
    technique.  I often use Apple's and other standard library methods
    and functions instead of rolling my own, since the prior are likely
    to be more efficient, well tested, and heavily optimized.

    Good luck,
    Sean
  • On Mon, 23 Oct 2006 12:16:12 +0200, xidiar <info...> said:
    > I'm searching a function to search within a string of an NSDictionary
    > fast as iTunes search method.

    Not sure what "a string of an NSDictionary" is, but you might want to look
    into SearchKit. m.

    --
    matt neuburg, phd = <matt...>, <http://www.tidbits.com/matt/>
    A fool + a tool + an autorelease pool = cool!
    AppleScript: the Definitive Guide - Second Edition!
    <http://www.amazon.com/gp/product/0596102119>
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today