searcher/searchclient/src/ccpixsearcher.cpp
changeset 1 6f2c1c46032b
parent 0 671dee74050a
child 8 6547bf8ca13a
equal deleted inserted replaced
0:671dee74050a 1:6f2c1c46032b
    21 
    21 
    22 #include "SearchClient.pan"
    22 #include "SearchClient.pan"
    23 #include "CCPixSearcher.h"
    23 #include "CCPixSearcher.h"
    24 #include "MCPixSearcherObserver.h"
    24 #include "MCPixSearcherObserver.h"
    25 #include "SearchServerCommon.h"
    25 #include "SearchServerCommon.h"
       
    26 #include "OstTraceDefinitions.h"
       
    27 #ifdef OST_TRACE_COMPILER_IN_USE
       
    28 #include "ccpixsearcherTraces.h"
       
    29 #endif
       
    30 
    26 
    31 
    27 // CCPixSearcher::NewL()
    32 // CCPixSearcher::NewL()
    28 // Two-phased constructor.
    33 // Two-phased constructor.
    29 EXPORT_C CCPixSearcher* CCPixSearcher::NewL(RSearchServerSession& aSearchServerSession, const TDesC& aDefaultSearchField)
    34 EXPORT_C CCPixSearcher* CCPixSearcher::NewL(RSearchServerSession& aSearchServerSession, const TDesC& aDefaultSearchField)
    30 	{
    35 	{
   177 
   182 
   178 // CCPixSearcher::Search()
   183 // CCPixSearcher::Search()
   179 // Issues a new search
   184 // Issues a new search
   180 EXPORT_C TInt CCPixSearcher::SearchL(const TDesC& aQueryString, const TDesC& aDocumentField)
   185 EXPORT_C TInt CCPixSearcher::SearchL(const TDesC& aQueryString, const TDesC& aDocumentField)
   181 	{
   186 	{
       
   187 	OstTraceFunctionEntry0( CCPIXSEARCHER_SEARCHL_ENTRY );
   182 	PERFORMANCE_LOG_START("CCPixSearcher::SearchL");
   188 	PERFORMANCE_LOG_START("CCPixSearcher::SearchL");
   183 	
   189 	
   184 	if ( !iIsDatabaseOpen ) 	
   190 	if ( !iIsDatabaseOpen ) 	
   185 		User::Leave( KErrNotReady );
   191 		User::Leave( KErrNotReady );
   186 	if ( IsActive() )
   192 	if ( IsActive() )
   198 	return iSubSession.GetEstimatedDocumentCount();
   204 	return iSubSession.GetEstimatedDocumentCount();
   199 	}
   205 	}
   200 
   206 
   201 EXPORT_C void CCPixSearcher::SearchL(MCPixSearchRequestObserver& aObserver, const TDesC& aQueryString, const TDesC& aDocumentField)
   207 EXPORT_C void CCPixSearcher::SearchL(MCPixSearchRequestObserver& aObserver, const TDesC& aQueryString, const TDesC& aDocumentField)
   202 	{
   208 	{
       
   209     OstTraceFunctionEntry0( DUP1_CCPIXSEARCHER_SEARCHL_ENTRY );
   203     PERFORMANCE_LOG_START("CCPixSearcher::SearchL");
   210     PERFORMANCE_LOG_START("CCPixSearcher::SearchL");
   204 
   211 
   205 	if ( !iIsDatabaseOpen ) 	User::Leave( KErrNotReady );
   212 	if ( !iIsDatabaseOpen ) 	User::Leave( KErrNotReady );
   206 	if ( IsActive() )
   213 	if ( IsActive() )
   207 		{
   214 		{
   213 	iQueryString = FormQueryStringL( aQueryString, aDocumentField ); 
   220 	iQueryString = FormQueryStringL( aQueryString, aDocumentField ); 
   214 
   221 
   215 	iObserver.iSearch = &aObserver;
   222 	iObserver.iSearch = &aObserver;
   216 	iState = EStateSearch;
   223 	iState = EStateSearch;
   217 	iSubSession.Search( *iQueryString, iStatus );
   224 	iSubSession.Search( *iQueryString, iStatus );
   218 	SetActive();
   225 	OstTraceFunctionExit0( CCPIXSEARCHER_SEARCHL_EXIT );
   219 
   226 	SetActive();	
   220 	}
   227 	}
   221 
   228 
   222 EXPORT_C CSearchDocument* CCPixSearcher::GetDocumentL(TInt aIndex)
   229 EXPORT_C CSearchDocument* CCPixSearcher::GetDocumentL(TInt aIndex)
   223     {
   230     {
       
   231     OstTraceFunctionEntry0( CCPIXSEARCHER_GETDOCUMENTL_ENTRY );
   224     PERFORMANCE_LOG_START("CCPixSearcher::GetDocumentL");
   232     PERFORMANCE_LOG_START("CCPixSearcher::GetDocumentL");
   225     
   233     
   226 	if ( !iIsDatabaseOpen ) 	User::Leave( KErrNotReady );
   234 	if ( !iIsDatabaseOpen ) 	User::Leave( KErrNotReady );
   227 	if ( IsActive() )
   235 	if ( IsActive() )
   228 		{
   236 		{
   232 	return iSubSession.GetDocumentL(aIndex);
   240 	return iSubSession.GetDocumentL(aIndex);
   233     }
   241     }
   234 
   242 
   235 EXPORT_C void CCPixSearcher::GetDocumentL(TInt aIndex, MCPixNextDocumentRequestObserver& aObserver)
   243 EXPORT_C void CCPixSearcher::GetDocumentL(TInt aIndex, MCPixNextDocumentRequestObserver& aObserver)
   236     {
   244     {
       
   245     OstTraceFunctionEntry0( DUP1_CCPIXSEARCHER_GETDOCUMENTL_ENTRY );
   237     PERFORMANCE_LOG_START("CCPixSearcher::GetDocumentL");
   246     PERFORMANCE_LOG_START("CCPixSearcher::GetDocumentL");
   238     
   247     
   239     if ( !iIsDatabaseOpen ) 	User::Leave( KErrNotReady );
   248     if ( !iIsDatabaseOpen ) 	User::Leave( KErrNotReady );
   240 	if ( IsActive() )
   249 	if ( IsActive() )
   241 		{
   250 		{
   244 	
   253 	
   245 	iObserver.iNextDocument = &aObserver;
   254 	iObserver.iNextDocument = &aObserver;
   246 	
   255 	
   247 	iState = EStateGetDocument;
   256 	iState = EStateGetDocument;
   248 	iSubSession.GetDocument(aIndex, iStatus);
   257 	iSubSession.GetDocument(aIndex, iStatus);
   249 	SetActive(); 
   258 	OstTraceFunctionExit0( CCPIXSEARCHER_GETDOCUMENTL_EXIT );
       
   259 	SetActive();     
   250     }
   260     }
   251 
   261 
   252 // CCPixSearcher::RunL()
   262 // CCPixSearcher::RunL()
   253 // Invoked to handle responses from the server.
   263 // Invoked to handle responses from the server.
   254 void CCPixSearcher::RunL()
   264 void CCPixSearcher::RunL()