Re: phrase searching with SearchKit
Re: phrase searching with SearchKit
- Subject: Re: phrase searching with SearchKit
- From: Michael Thon <email@hidden>
- Date: Fri, 2 Jul 2010 20:07:47 +0200
On Jul 2, 2010, at 11:09 AM, Michael Thon wrote:
> I'm trying to set up an index with SearchKit and search it with quoted phrases. It is my understanding that I need to enable proximity indexing to get phrase searches to work. If I don't enable proximity indexing, then it seems like my quoted string is treated as separate search terms. However, when I enable proximity indexing, my quoted string doesn't return any hits from the index. The string I'm searching is from a document I know has been indexed. When I try the quoted string with Spotlight, I can find the document. Here is the code I'm using to create the database:
>
>
> CFMutableDictionaryRef props = CFDictionaryCreateMutable(NULL, 0,
> &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
> CFDictionaryAddValue(props, kSKProximityIndexing, kCFBooleanTrue);
>
> theIndex = SKIndexCreateWithURL((CFURLRef) url,
> (CFStringRef) dbName,
> kSKIndexInverted,
> props);
>
>
> Anyone know what I'm doing wrong?
Answering my own question -
you need to execute this function:
SKIndexFlush(theIndex);
before closing the index:
SKIndexClose (theIndex);
SKIndexFlush dosen't seem to occur in the example code that is in the SearchKit programming guide but it is buried in the text. If you fail to fail to call SKIndexFlush or SKIndexClose you apparently get an index that SearchKit can search (without errors) but the results are unpredictable.
_______________________________________________
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