Hi all.

In my application I have to search for strings closest matching a given string. So, for example, if the "given string" is "Hello. Would you like some oranges", I need to find "Hello. Would you like some lemons" or "Hello. Would you want some oranges" (if they are in the database), and not just any phrase that contains the word "oranges" or "would" or "hello", etc.

For this purpose I tried to use the SearchKit, and tried to filter out the strings that were below a certain relevancy threshold and compare the remaining ones to the "given string" using some other methods. However, it turns out, that the bigger the database with the strings gets, the more irrelevant strings i receive, and the whole search process becomes quite slow.

And my question is, am I right in thinking that the SearchKit may not be the solution that I want and I will have to write my own indexing engine, or is it just that I am not using it right?

Here is how I create the index (the code was almost entirely taken from a code example):

- (void) newIndexInFile  {
        NSURL * url = [NSURL fileURLWithPath: path];
        NSString * name = @"SomeName";
        if ([name length] == 0) name = nil;
        SKIndexType type = kSKIndexInvertedVector;
        NSNumber * minTermLength = [NSNumber numberWithInt: (int) 3];
        NSSet * stopwords = [NSSet setWithObjects:
                                                 @"all",
                                                 @"and",
                                                 @"its",
                                                 @"it's",
                                                 @"the",
                                                 nil
                                                 ];
        NSDictionary * properties =
        [NSDictionary dictionaryWithObjectsAndKeys:
         @"", @"kSKStartTermChars",
         @"-...@.'", @"kSKTermChars",
         @"", @"kSKEndTermChars",
         minTermLength, @"kSKMinTermLength",
         stopwords, @"kSKStopWords",
         nil
         ];
        skIndex = SKIndexCreateWithURL(
                                                                   (CFURLRef) 
url,
                                                                   
(CFStringRef) name,
                                                                   
(SKIndexType) type,
                                                                   
(CFDictionaryRef) properties
                                                                   );
        if (!skIndex) {
                NSLog(@"SKIndex doesnt exist right after the creation");
        }
}
Thank you for your attention.
Timofey.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to