SearchKit code question
SearchKit code question
- Subject: SearchKit code question
- From: Demitri Muna <email@hidden>
- Date: Thu, 26 May 2005 12:33:00 +0100
Hello,
I'm playing with the new SearchKit routines, and I have not been able
to get a simple test case to work. I'm trying to create an index,
index a single document, and perform a search against it, but I get
nothing back. Can someone spot what I'm missing?
Thanks!
Demitri
======
CFURLRef pathURL = (CFURLRef)[NSURL URLWithString:@"file:///
Users/demitri/sk_index"];
CFStringRef indexName = NULL;
SKIndexRef indexRef = SKIndexCreateWithURL(pathURL,
indexName,
kSKIndexInvertedVector,
NULL);
NSString *path;
SKDocumentRef documentRef;
BOOL result;
// index document
path = @"/Developer/ADC Reference Library/documentation/
UserExperience/Reference/SearchKit/SearchKitReference/
chapter_1.2_section_3.html";
documentRef = SKDocumentCreateWithURL((CFURLRef)[NSURL
fileURLWithPath:path]);
result = SKIndexAddDocument(indexRef, documentRef, NULL, 1);
CFRelease(documentRef); // release doc ref
// flush index
result = SKIndexFlush(indexRef);
// prepare search
CFStringRef query = (CFStringRef)@"index";
SKSearchRef searchRef = SKSearchCreate(indexRef, query, NULL);
// perform search
int maximumResultsCount = 5;
//CFMutableArrayRef outDocumentsIDsArray = CFArrayCreateMutable
(NULL,0,NULL);
//CFMutableArrayRef outScoresArray = CFArrayCreateMutable(NULL,
0,NULL);
SKDocumentID outDocumentsIDsArray;
float outScoresArray;
CFTimeInterval maximumTime = 0;
CFIndex outFoundCount;
result = SKSearchFindMatches(searchRef, maximumResultsCount,
&outDocumentsIDsArray,
&outScoresArray, maximumTime,
&outFoundCount);
======
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden