searcher/searchclient/src/rsearchserversession.cpp
changeset 1 6f2c1c46032b
parent 0 671dee74050a
child 8 6547bf8ca13a
equal deleted inserted replaced
0:671dee74050a 1:6f2c1c46032b
    22 #include "common.h"
    22 #include "common.h"
    23 #include "SearchServerLogger.h"
    23 #include "SearchServerLogger.h"
    24 #include "SearchServerCommon.h"
    24 #include "SearchServerCommon.h"
    25 #include "RSearchServerSession.h"
    25 #include "RSearchServerSession.h"
    26 #include "CSearchDocument.h"
    26 #include "CSearchDocument.h"
       
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "rsearchserversessionTraces.h"
       
    30 #endif
       
    31 
    27 
    32 
    28 
    33 
    29 // FUNCTION PROTOTYPES
    34 // FUNCTION PROTOTYPES
    30 static TInt StartServer();
    35 static TInt StartServer();
    31 static TInt CreateServerProcess();
    36 static TInt CreateServerProcess();
   189 
   194 
   190 
   195 
   191 // RSearchServerSubSession::Search()
   196 // RSearchServerSubSession::Search()
   192 EXPORT_C void RSearchServerSubSession::SearchL(const TDesC& aSearchTerms)
   197 EXPORT_C void RSearchServerSubSession::SearchL(const TDesC& aSearchTerms)
   193 	{
   198 	{
       
   199 	OstTraceFunctionEntry0( RSEARCHSERVERSUBSESSION_SEARCHL_ENTRY );
   194 	PERFORMANCE_LOG_START("RSearchServerSubSession::SearchL");
   200 	PERFORMANCE_LOG_START("RSearchServerSubSession::SearchL");
   195 	
   201 	
   196 	iEstimatedResultsCount = 0;
   202 	iEstimatedResultsCount = 0;
   197 
   203 
   198 	// Message arguments for the server
   204 	// Message arguments for the server
   201 	// This call completes immediately, however the server will not
   207 	// This call completes immediately, however the server will not
   202 	// complete the request until later, so don't pass any local
   208 	// complete the request until later, so don't pass any local
   203 	// descriptors as they will be out of scope by the time the server
   209 	// descriptors as they will be out of scope by the time the server
   204 	// attempts to read or write
   210 	// attempts to read or write
   205 	User::LeaveIfError( SendReceive(ESearchServerSearch, args) );
   211 	User::LeaveIfError( SendReceive(ESearchServerSearch, args) );
       
   212 	OstTraceFunctionExit0( RSEARCHSERVERSUBSESSION_SEARCHL_EXIT );
   206 	}
   213 	}
   207 
   214 
   208 EXPORT_C void RSearchServerSubSession::Search(const TDesC& aSearchTerms, TRequestStatus& aStatus)
   215 EXPORT_C void RSearchServerSubSession::Search(const TDesC& aSearchTerms, TRequestStatus& aStatus)
   209 	{
   216 	{
       
   217 	OstTraceFunctionEntry0( RSEARCHSERVERSUBSESSION_SEARCH_ENTRY );
   210 	PERFORMANCE_LOG_START("RSearchServerSubSession::SearchL");
   218 	PERFORMANCE_LOG_START("RSearchServerSubSession::SearchL");
   211 	
   219 	
   212 	iEstimatedResultsCount = 0;
   220 	iEstimatedResultsCount = 0;
   213 
   221 
   214 	// Message arguments for the server
   222 	// Message arguments for the server
   217 	// This call completes immediately, however the server will not
   225 	// This call completes immediately, however the server will not
   218 	// complete the request until later, so don't pass any local
   226 	// complete the request until later, so don't pass any local
   219 	// descriptors as they will be out of scope by the time the server
   227 	// descriptors as they will be out of scope by the time the server
   220 	// attempts to read or write
   228 	// attempts to read or write
   221 	SendReceive(ESearchServerSearch, args, aStatus);
   229 	SendReceive(ESearchServerSearch, args, aStatus);
       
   230 	OstTraceFunctionExit0( RSEARCHSERVERSUBSESSION_SEARCH_EXIT );
   222 	}
   231 	}
   223 
   232 
   224 // RSearchServerSubSession::GetEstimatedDocumentCount()
   233 // RSearchServerSubSession::GetEstimatedDocumentCount()
   225 TInt RSearchServerSubSession::GetEstimatedDocumentCount()
   234 TInt RSearchServerSubSession::GetEstimatedDocumentCount()
   226 	{
   235 	{
   228 	}
   237 	}
   229 
   238 
   230 // RSearchServerSubSession::GetDocument()
   239 // RSearchServerSubSession::GetDocument()
   231 EXPORT_C CSearchDocument* RSearchServerSubSession::GetDocumentL(TInt aIndex)
   240 EXPORT_C CSearchDocument* RSearchServerSubSession::GetDocumentL(TInt aIndex)
   232 	{
   241 	{
       
   242 	OstTraceFunctionEntry0( RSEARCHSERVERSUBSESSION_GETDOCUMENTL_ENTRY );
   233 	PERFORMANCE_LOG_START("RSearchServerSubSession::GetDocumentL");
   243 	PERFORMANCE_LOG_START("RSearchServerSubSession::GetDocumentL");
   234 	
   244 	
   235 	iDocumentSize = 0;
   245 	iDocumentSize = 0;
   236 
   246 
   237 	// Message arguments for the server
   247 	// Message arguments for the server
   242 	return GetDocumentObjectL(); 
   252 	return GetDocumentObjectL(); 
   243 	}
   253 	}
   244 
   254 
   245 EXPORT_C void RSearchServerSubSession::GetDocument(TInt aIndex, TRequestStatus& aStatus)
   255 EXPORT_C void RSearchServerSubSession::GetDocument(TInt aIndex, TRequestStatus& aStatus)
   246 	{
   256 	{
       
   257 	OstTraceFunctionEntry0( RSEARCHSERVERSUBSESSION_GETDOCUMENT_ENTRY );
   247 	PERFORMANCE_LOG_START("RSearchServerSubSession::GetDocument");
   258 	PERFORMANCE_LOG_START("RSearchServerSubSession::GetDocument");
   248 
   259 
   249 	iDocumentSize = 0;
   260 	iDocumentSize = 0;
   250 
   261 
   251 	// Message arguments for the server
   262 	// Message arguments for the server
   252 	TIpcArgs args(aIndex, &iDocumentSizePckg);
   263 	TIpcArgs args(aIndex, &iDocumentSizePckg);
   253 
   264 
   254 	SendReceive(ESearchServerGetDocument, args, aStatus );	
   265 	SendReceive(ESearchServerGetDocument, args, aStatus );	
       
   266 	OstTraceFunctionExit0( RSEARCHSERVERSUBSESSION_GETDOCUMENT_EXIT );
   255 	}
   267 	}
   256 
   268 
   257 
   269 
   258 EXPORT_C CSearchDocument* RSearchServerSubSession::GetDocumentObjectL()
   270 EXPORT_C CSearchDocument* RSearchServerSubSession::GetDocumentObjectL()
   259 	{
   271 	{
       
   272 	OstTraceFunctionEntry0( RSEARCHSERVERSUBSESSION_GETDOCUMENTOBJECTL_ENTRY );
   260 	PERFORMANCE_LOG_START("CCPixSearcher::GetDocumentObjectL");
   273 	PERFORMANCE_LOG_START("CCPixSearcher::GetDocumentObjectL");
   261 	
   274 	
   262 	CSearchDocument* document = NULL;
   275 	CSearchDocument* document = NULL;
   263 	if (iDocumentSize>0)
   276 	if (iDocumentSize>0)
   264 		{
   277 		{
   273 		CleanupStack::Pop(document);
   286 		CleanupStack::Pop(document);
   274 		CleanupStack::PopAndDestroy(&stream);
   287 		CleanupStack::PopAndDestroy(&stream);
   275 		CleanupStack::PopAndDestroy(buf);
   288 		CleanupStack::PopAndDestroy(buf);
   276 		}
   289 		}
   277 	
   290 	
       
   291 	OstTraceFunctionExit0( RSEARCHSERVERSUBSESSION_GETDOCUMENTOBJECTL_EXIT );
   278 	return document;
   292 	return document;
   279 	}
   293 	}
   280 
   294 
   281 // RSearchServerSubSession::CancelSearch()
   295 // RSearchServerSubSession::CancelSearch()
   282 // Cancels outstanding search from server
   296 // Cancels outstanding search from server
   321 
   335 
   322 // Updates the serialized document in the index
   336 // Updates the serialized document in the index
   323 EXPORT_C void RSearchServerSubSession::UpdateL(const TDesC8& aSerializedDocument)
   337 EXPORT_C void RSearchServerSubSession::UpdateL(const TDesC8& aSerializedDocument)
   324 	{
   338 	{
   325 	TIpcArgs args(&aSerializedDocument);
   339 	TIpcArgs args(&aSerializedDocument);
       
   340 	OstTrace0( TRACE_NORMAL, RSEARCHSERVERSUBSESSION_UPDATEL, "RSearchServerSubSession::UpdateL(): sending the request to server" );
   326 	CPIXLOGSTRING( "RSearchServerSubSession::UpdateL(): sending the request to server" );
   341 	CPIXLOGSTRING( "RSearchServerSubSession::UpdateL(): sending the request to server" );
   327 	User::LeaveIfError( SendReceive(ESearchServerUpdate, args) );
   342 	User::LeaveIfError( SendReceive(ESearchServerUpdate, args) );
       
   343 	OstTrace0( TRACE_NORMAL, DUP1_RSEARCHSERVERSUBSESSION_UPDATEL, "RSearchServerSubSession::UpdateL(): sent the request to server success" );
   328 	CPIXLOGSTRING( "RSearchServerSubSession::UpdateL(): sent the request to server success" );
   344 	CPIXLOGSTRING( "RSearchServerSubSession::UpdateL(): sent the request to server success" );
   329 	}
   345 	}
   330 
   346 
   331 // Deletes the document uid in the index
   347 // Deletes the document uid in the index
   332 EXPORT_C void RSearchServerSubSession::DeleteL(const TDesC& aDocUid)
   348 EXPORT_C void RSearchServerSubSession::DeleteL(const TDesC& aDocUid)