equal
deleted
inserted
replaced
43 self->ConstructL(); |
43 self->ConstructL(); |
44 return self; |
44 return self; |
45 } |
45 } |
46 |
46 |
47 CCPixSearch::CCPixSearch() |
47 CCPixSearch::CCPixSearch() |
48 : iQueryParserType(EIncrementalQueryParser), |
48 : iQueryParserType(EPrefixQueryParser), |
49 iPendingTask(EPendingTaskNone) |
49 iPendingTask(EPendingTaskNone) |
50 |
50 |
51 { |
51 { |
52 } |
52 } |
53 |
53 |
132 asyncronizer->CompletionCallback(); |
132 asyncronizer->CompletionCallback(); |
133 } |
133 } |
134 |
134 |
135 TBool CCPixSearch::SearchL(const TDesC& aSearchTerms, MCPixAsyncronizerObserver* aObserver, const RMessage2& aMessage) |
135 TBool CCPixSearch::SearchL(const TDesC& aSearchTerms, MCPixAsyncronizerObserver* aObserver, const RMessage2& aMessage) |
136 { |
136 { |
|
137 _LIT16(KPlain,"$plain"); |
|
138 _LIT16(KPrefix,"$prefix"); |
137 OstTraceFunctionEntry0( CCPIXSEARCH_SEARCHL_ENTRY ); |
139 OstTraceFunctionEntry0( CCPIXSEARCH_SEARCHL_ENTRY ); |
138 PERFORMANCE_LOG_START("CCPixSearch::SearchL"); |
140 PERFORMANCE_LOG_START("CCPixSearch::SearchL"); |
139 |
141 |
140 if (iPendingTask != EPendingTaskNone) |
142 if (iPendingTask != EPendingTaskNone) |
141 User::Leave(KErrInUse); |
143 User::Leave(KErrInUse); |
146 iHits = NULL; |
148 iHits = NULL; |
147 // Allocate search terms (allow zero termination) |
149 // Allocate search terms (allow zero termination) |
148 HBufC* searchTerms = HBufC::NewLC(aSearchTerms.Length() + 1); |
150 HBufC* searchTerms = HBufC::NewLC(aSearchTerms.Length() + 1); |
149 TPtr searchTermsPtr = searchTerms->Des(); |
151 TPtr searchTermsPtr = searchTerms->Des(); |
150 searchTermsPtr.Copy(aSearchTerms); |
152 searchTermsPtr.Copy(aSearchTerms); |
|
153 |
|
154 if(aSearchTerms.Find(KPlain) == 0 && iQueryParserType == EPrefixQueryParser ) |
|
155 { |
|
156 SetQueryParserL(ECluceneQueryParser); |
|
157 } |
|
158 else if (aSearchTerms.Find(KPrefix) == 0 && iQueryParserType == ECluceneQueryParser ) |
|
159 { |
|
160 SetQueryParserL(EPrefixQueryParser); |
|
161 } |
151 |
162 |
152 // Destroy previous query |
163 // Destroy previous query |
153 cpix_Query_destroy( iQuery ); |
164 cpix_Query_destroy( iQuery ); |
154 iQuery = NULL; |
165 iQuery = NULL; |
155 |
166 |
377 { |
388 { |
378 cpix_QueryParser_destroy( iQueryParser ); |
389 cpix_QueryParser_destroy( iQueryParser ); |
379 iQueryParser = NULL; |
390 iQueryParser = NULL; |
380 cpix_Result result; |
391 cpix_Result result; |
381 |
392 |
382 if ( iQueryParserType == EDatabaseQueryParser ) |
393 if ( iQueryParserType == ECluceneQueryParser ) |
383 { |
394 { |
384 iQueryParser = |
395 iQueryParser = |
385 cpix_QueryParser_create( &result, |
396 cpix_QueryParser_create( &result, |
386 reinterpret_cast<const wchar_t*>( |
397 reinterpret_cast<const wchar_t*>( |
387 iDefaultSearchFieldZ->Des().PtrZ()), |
398 iDefaultSearchFieldZ->Des().PtrZ()), |
388 iAnalyzer ); |
399 iAnalyzer ); |
389 } |
400 } |
390 else if ( iQueryParserType == EIncrementalQueryParser ) |
401 else if ( iQueryParserType == EPrefixQueryParser ) |
391 { |
402 { |
392 iQueryParser = |
403 iQueryParser = |
393 cpix_CreatePrefixQueryParser( &result, |
404 cpix_CreatePrefixQueryParser( &result, |
394 reinterpret_cast<const wchar_t*>( |
405 reinterpret_cast<const wchar_t*>( |
395 iDefaultSearchFieldZ->Des().PtrZ()) ); |
406 iDefaultSearchFieldZ->Des().PtrZ()) ); |