테스트를 위해 6 권의 잡지가 있으며 각각 색인이 있습니다. 따라서 인덱스의 크기는 다음과 같습니다
434킬로바이트, 41킬로바이트, 1백39킬로바이트, 434킬로바이트, 57킬로바이트 및 57킬로바이트
색인에 대한 나의 코드는 다음과 같습니다
LCSimpleAnalyzer *analyzer = [[LCSimpleAnalyzeralloc] init];
LCIndexWriter *writer = [[LCIndexWriteralloc] initWithDirectory:[selfcreateFileDirectoryWithEmagPath:emagModel.emagPath] analyzer: analyzer create: YES];
...
// creating searchResult
...
// adding relevant information to lucene document
LCDocument *doc = [[LCDocumentalloc] init];
LCField *fieldContent = [[LCFieldalloc] initWithName: @"content_to_search"string:bodyText store:LCStore_YES index:LCIndex_Tokenized];
LCField *fieldResult = [[LCFieldalloc] initWithName:@"data" data: [NSKeyedArchiverarchivedDataWithRootObject:result] store:LCStore_YES];
[doc addField:fieldContent];
[doc addField:fieldResult];
[writer addDocument:doc];
...
// releasing stuff and close writer
그리고 그 검색에 대한 코드입니다 :
// search
LCIndexSearcher *searcher = [[LCIndexSearcheralloc] initWithDirectory: [selfgetFileDirectoryOfEmagPath:emagPath]];
LCTerm *term = [[LCTermalloc] initWithField: @"content_to_search" text: self.searchText];
LCTermQuery *termQuery = [[LCTermQueryalloc] initWithTerm:term];
LCHits *hits = [searcher search:termQuery];
thx
이 응답 시간은 특히 간단한 검색어에 대해 매우 높습니다. 라이브러리 코드 나 클라이언트 코드에서 실제로 잘못된 점이 있습니다. Lucene에 익숙하지만 iOS에 익숙하지 않습니다. iOS에서 병목 현상을 찾는 데 도움이되는 프로파일 링 도구가 있습니까? – jpountz
예, 그들은 일종의 최고이지만, 시간을 비교해 보면 최대 8 팩터로 차별화되고 있으며, 저를 혼란스럽게합니다. 그래서 "Astronomie"라는 단어는 1 초가 걸리고 "Tag"같은 단어는 8 초 이상 걸립니다. 왜 그런가요? –