equal
deleted
inserted
replaced
73 return 0; |
73 return 0; |
74 } |
74 } |
75 |
75 |
76 *idxDb_ = cpix_IdxDb_openDb(&result, |
76 *idxDb_ = cpix_IdxDb_openDb(&result, |
77 TEST_DOCUMENT_QBASEAPPCLASS, |
77 TEST_DOCUMENT_QBASEAPPCLASS, |
78 cpix_IDX_CREATE); |
78 cpix_IDX_OPEN); |
79 if (cpix_Failed(&result)) |
79 if (cpix_Failed(&result)) |
80 { |
80 { |
81 printf("Failed to open indexDb\n"); |
81 printf("Failed to open indexDb\n"); |
82 return 0; |
82 return 0; |
83 } |
83 } |
185 printf("Hits failed\n"); |
185 printf("Hits failed\n"); |
186 return; |
186 return; |
187 } |
187 } |
188 |
188 |
189 cout << "Number of hits: " << hitCount << endl; |
189 cout << "Number of hits: " << hitCount << endl; |
190 |
190 while (1) |
|
191 { |
|
192 int fromDoc; |
|
193 int docCount; |
|
194 printf("\nFrom: "); |
|
195 scanf("%d",&fromDoc); |
|
196 printf("\nHow many doc: "); |
|
197 scanf("%d",&docCount); |
|
198 |
191 cpix_Document |
199 cpix_Document |
192 doc; |
200 **doc; |
193 |
201 |
194 for (int32_t i = 0; i < hitCount; ++i) |
202 doc = (cpix_Document **) malloc (sizeof(cpix_Document *) * docCount); |
195 { |
203 for(int j = 0 ; j < docCount; j++) |
|
204 { |
|
205 doc[j] = (cpix_Document *) malloc (sizeof(cpix_Document)); |
|
206 doc[j]->ptr_ = NULL; |
|
207 } |
|
208 |
196 cpix_Hits_doc(hits, |
209 cpix_Hits_doc(hits, |
197 i, |
210 fromDoc, |
198 &doc); |
211 doc, |
199 |
212 docCount); |
200 printHit(&doc); |
213 |
|
214 for(int j = 0 ; docCount>j && doc[j]->ptr_ != NULL; j++) |
|
215 { |
|
216 printf("%d \n", j); |
|
217 printHit(doc[j]); |
|
218 } |
|
219 |
|
220 for(int j = 0 ; j < docCount; j++) |
|
221 free(doc[j]); |
|
222 |
|
223 |
|
224 free(doc); |
|
225 |
201 } |
226 } |
202 logDbgMsg("Shankar Ha hahah"); |
227 logDbgMsg("Shankar Ha hahah"); |
203 } |
228 } |
204 |
229 |
205 int main(void) |
230 int main(void) |
210 cpix_QueryParser * queryParser_; |
235 cpix_QueryParser * queryParser_; |
211 cpix_Query * query_; |
236 cpix_Query * query_; |
212 cpix_IdxDb * idxDb_ = NULL; |
237 cpix_IdxDb * idxDb_ = NULL; |
213 cpix_Hits * hits_; |
238 cpix_Hits * hits_; |
214 |
239 |
215 printf("Press a character to exit!\n"); |
240 |
216 |
241 |
217 testInit(&analyzer_,&idxDb_); |
242 testInit(&analyzer_,&idxDb_); |
|
243 for(int j = 0; j < 10; j++) |
|
244 { |
218 createDocument(LDOCUID1,DOC1CONTENT, &analyzer_,&idxDb_); |
245 createDocument(LDOCUID1,DOC1CONTENT, &analyzer_,&idxDb_); |
219 createDocument(LDOCUID2,DOC2CONTENT, &analyzer_,&idxDb_); |
246 createDocument(LDOCUID2,DOC2CONTENT, &analyzer_,&idxDb_); |
|
247 } |
220 |
248 |
221 |
249 |
222 queryParser_ = cpix_QueryParser_create(&result, |
250 queryParser_ = cpix_QueryParser_create(&result, |
223 L"_aggregate", |
251 L"_aggregate", |
224 analyzer_); |
252 analyzer_); |