SearchKit quiestion.
SearchKit quiestion.
- Subject: SearchKit quiestion.
- From: Тимофей Даньшин <email@hidden>
- Date: Mon, 16 Mar 2009 18:31:32 +0300
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 (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