19 #include "CSearchDocument.h" |
19 #include "CSearchDocument.h" |
20 #include "common.h" |
20 #include "common.h" |
21 #include "SearchServerLogger.h" |
21 #include "SearchServerLogger.h" |
22 #include "CCPixAsyncronizer.h" |
22 #include "CCPixAsyncronizer.h" |
23 #include "SearchServerHelper.h" |
23 #include "SearchServerHelper.h" |
|
24 #include "OstTraceDefinitions.h" |
|
25 #ifdef OST_TRACE_COMPILER_IN_USE |
|
26 #include "ccpixsearchTraces.h" |
|
27 #endif |
|
28 |
24 |
29 |
25 namespace { |
30 namespace { |
26 |
31 |
27 /** |
32 /** |
28 * cpix_DocFieldEnum destroyer for TCleanupItem |
33 * cpix_DocFieldEnum destroyer for TCleanupItem |
115 } |
120 } |
116 |
121 |
117 void CCPixSearch::LogCancelAction(cpix_CancelAction aCancelAction) |
122 void CCPixSearch::LogCancelAction(cpix_CancelAction aCancelAction) |
118 { |
123 { |
119 #ifdef CPIX_LOGGING_ENABLED |
124 #ifdef CPIX_LOGGING_ENABLED |
|
125 OstTrace1( TRACE_NORMAL, CCPIXSEARCH_LOGCANCELACTION, "CCPixSearch::LogCancelAction;Cancel action code=%d", aCancelAction ); |
120 CPIXLOGSTRING2("Cancel action code %d", aCancelAction); |
126 CPIXLOGSTRING2("Cancel action code %d", aCancelAction); |
121 #endif // CPIX_LOGGING_ENABLED |
127 #endif // CPIX_LOGGING_ENABLED |
122 } |
128 } |
123 |
129 |
124 void CCPixSearch::CompletionCallback(void *aCookie, cpix_JobId aJobId) |
130 void CCPixSearch::CompletionCallback(void *aCookie, cpix_JobId aJobId) |
135 asyncronizer->CompletionCallback(); |
141 asyncronizer->CompletionCallback(); |
136 } |
142 } |
137 |
143 |
138 TBool CCPixSearch::SearchL(const TDesC& aSearchTerms, MCPixAsyncronizerObserver* aObserver, const RMessage2& aMessage) |
144 TBool CCPixSearch::SearchL(const TDesC& aSearchTerms, MCPixAsyncronizerObserver* aObserver, const RMessage2& aMessage) |
139 { |
145 { |
|
146 OstTraceFunctionEntry0( CCPIXSEARCH_SEARCHL_ENTRY ); |
140 PERFORMANCE_LOG_START("CCPixSearch::SearchL"); |
147 PERFORMANCE_LOG_START("CCPixSearch::SearchL"); |
141 |
148 |
142 if (iPendingTask != EPendingTaskNone) |
149 if (iPendingTask != EPendingTaskNone) |
143 User::Leave(KErrInUse); |
150 User::Leave(KErrInUse); |
144 |
151 |
168 iPendingJobId = cpix_IdxSearcher_asyncSearch(iIdxDb, iQuery, (void*)this, &CompletionCallback); |
175 iPendingJobId = cpix_IdxSearcher_asyncSearch(iIdxDb, iQuery, (void*)this, &CompletionCallback); |
169 SearchServerHelper::CheckCpixErrorL(iIdxDb, KErrDatabaseQueryFailed); |
176 SearchServerHelper::CheckCpixErrorL(iIdxDb, KErrDatabaseQueryFailed); |
170 iPendingTask = EPendingTaskSearch; |
177 iPendingTask = EPendingTaskSearch; |
171 iAsyncronizer->Start(ECPixTaskTypeSearch, aObserver, aMessage); |
178 iAsyncronizer->Start(ECPixTaskTypeSearch, aObserver, aMessage); |
172 |
179 |
|
180 OstTraceFunctionExit0( CCPIXSEARCH_SEARCHL_EXIT ); |
173 return ETrue; |
181 return ETrue; |
174 } |
182 } |
175 |
183 |
176 // Search was not committed |
184 // Search was not committed |
|
185 OstTraceFunctionExit0( DUP1_CCPIXSEARCH_SEARCHL_EXIT ); |
177 return EFalse; |
186 return EFalse; |
178 } |
187 } |
179 |
188 |
180 TInt CCPixSearch::SearchCompleteL() |
189 TInt CCPixSearch::SearchCompleteL() |
181 { |
190 { |
|
191 OstTraceFunctionEntry0( CCPIXSEARCH_SEARCHCOMPLETEL_ENTRY ); |
182 PERFORMANCE_LOG_START("CCPixSearch::SearchCompleteL"); |
192 PERFORMANCE_LOG_START("CCPixSearch::SearchCompleteL"); |
183 // Request is no more pending |
193 // Request is no more pending |
184 iPendingTask = EPendingTaskNone; |
194 iPendingTask = EPendingTaskNone; |
185 |
195 |
186 // Get the hits |
196 // Get the hits |
187 iHits = cpix_IdxSearcher_asyncSearchResults(iIdxDb, iPendingJobId); |
197 iHits = cpix_IdxSearcher_asyncSearchResults(iIdxDb, iPendingJobId); |
188 SearchServerHelper::CheckCpixErrorL(iIdxDb, KErrDatabaseQueryFailed); |
198 SearchServerHelper::CheckCpixErrorL(iIdxDb, KErrDatabaseQueryFailed); |
189 iDocumentCount = cpix_Hits_length(iHits); |
199 iDocumentCount = cpix_Hits_length(iHits); |
190 SearchServerHelper::CheckCpixErrorL(iHits, KErrDatabaseQueryFailed); |
200 SearchServerHelper::CheckCpixErrorL(iHits, KErrDatabaseQueryFailed); |
191 |
201 |
|
202 OstTraceFunctionExit0( CCPIXSEARCH_SEARCHCOMPLETEL_EXIT ); |
192 return iDocumentCount; |
203 return iDocumentCount; |
193 } |
204 } |
194 |
205 |
195 void CCPixSearch::GetDocumentL(TInt aIndex, MCPixAsyncronizerObserver* aObserver, const RMessage2& aMessage) |
206 void CCPixSearch::GetDocumentL(TInt aIndex, MCPixAsyncronizerObserver* aObserver, const RMessage2& aMessage) |
196 { |
207 { |
|
208 OstTraceFunctionEntry0( CCPIXSEARCH_GETDOCUMENTL_ENTRY ); |
197 PERFORMANCE_LOG_START("CCPixSearch::GetDocumentL"); |
209 PERFORMANCE_LOG_START("CCPixSearch::GetDocumentL"); |
198 |
210 |
199 if (iPendingTask != EPendingTaskNone) |
211 if (iPendingTask != EPendingTaskNone) |
200 User::Leave(KErrInUse); |
212 User::Leave(KErrInUse); |
201 |
213 |
211 SearchServerHelper::LogErrorL(*(iHits->err_)); |
223 SearchServerHelper::LogErrorL(*(iHits->err_)); |
212 cpix_ClearError(iHits); |
224 cpix_ClearError(iHits); |
213 User::Leave(KErrDocumentAccessFailed); |
225 User::Leave(KErrDocumentAccessFailed); |
214 } |
226 } |
215 iAsyncronizer->Start(ECPixTaskTypeGetDocument, aObserver, aMessage); |
227 iAsyncronizer->Start(ECPixTaskTypeGetDocument, aObserver, aMessage); |
|
228 OstTraceFunctionExit0( CCPIXSEARCH_GETDOCUMENTL_EXIT ); |
216 } |
229 } |
217 |
230 |
218 CSearchDocument* CCPixSearch::GetDocumentCompleteL() |
231 CSearchDocument* CCPixSearch::GetDocumentCompleteL() |
219 { |
232 { |
|
233 OstTraceFunctionEntry0( CCPIXSEARCH_GETDOCUMENTCOMPLETEL_ENTRY ); |
220 PERFORMANCE_LOG_START("CCPixSearch::GetDocumentCompleteL"); |
234 PERFORMANCE_LOG_START("CCPixSearch::GetDocumentCompleteL"); |
221 |
235 |
222 // Request is no more pending |
236 // Request is no more pending |
223 iPendingTask = EPendingTaskNone; |
237 iPendingTask = EPendingTaskNone; |
224 |
238 |