• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSPredicate like NSLiteralSearch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPredicate like NSLiteralSearch


  • Subject: Re: NSPredicate like NSLiteralSearch
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Wed, 16 Dec 2009 00:55:31 +0700

On 15 Dec 2009, at 23:13, Jim Turner wrote:

> I believe you need the diacritic insensitive option:
>
> 'someProperty BEGINSWITH[d] "ก"'

Well, no. BEGINSWITH[d] tells me that "กิน" begins with "กุ" - that is: it ignores not only the tone-marks, but also some vowels, which makes it quite unusable for Thai text.

MATCHES can be used (it seems to act like NSLiteralSearch) but it is quite slow.
>
> Look up NSComparisonPredicate options in the documentation for more
> discussion.

NSComparisonPredicate Class Reference mentions under "NSComparisonPredicate Options" the [n] modifier.

I just tried it: BEGINSWITH[n] finds that "กิน" begins with "ก" - same as NSLiteralSearch.
But CONTAINS[n] does not work like NSLiteralSearch.

> As for what the 'w' means, it's Spotlight specific.  "The
> Comparison is word based, and also detects transitions from lower-case
> to upper-case."
>
> http://developer.apple.com/Mac/library/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/QueryFormat.html
>

Somehow I have the feeling that the documention for NSPredicates has some room for improvements.

Thanks very much for your links!

Gerriet.


> --
> Jim
> http://nukethemfromorbit.com
>
>
>
> On Tue, Dec 15, 2009 at 1:30 AM, Gerriet M. Denkmann
> <email@hidden> wrote:
>>
>> This works. i.e. returns {0,1}:
>> NSRange r2 = [ @"ก่ี" rangeOfString: @"ก" options: NSAnchoredSearch | NSLiteralSearch ];
>> (without NSLiteralSearch it returns NSNotFound).
>>
>> but an NSPredicate with: "someProperty BEGINSWITH "ก" " does NOT find ก่ี".
>> (the NSPredicate is to be used with -[NSArrayController setFilterPredicate:] to query Core Data).
>>
>> So: is there some string_option equivalent to NSLiteralSearch?
>>
>> And a related question: where are the available string_options defined?
>> The Predicate Programming Guide has:
>> string_options ::= c | d | cd
>>
>> but also an example with "w":
>> ((* = "FooBar*"wcd)) || (kMDItemTextContent = "FooBar*"cd))
>>
>> 10.6.2

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSPredicate like NSLiteralSearch (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: NSPredicate like NSLiteralSearch (From: Jim Turner <email@hidden>)

  • Prev by Date: Re: memcpy with 64 bit
  • Next by Date: Re: Sorted Table Column
  • Previous by thread: Re: NSPredicate like NSLiteralSearch
  • Next by thread: iPhone Testing Internet Connection?
  • Index(es):
    • Date
    • Thread