predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1MultiSearchHelper.cpp
branchRCL_3
changeset 35 4ae315f230bc
parent 32 2828b4d142c0
child 64 c1e8ba0c2b16
equal deleted inserted replaced
32:2828b4d142c0 35:4ae315f230bc
   448     CleanupClosePushL( tempqueryList );
   448     CleanupClosePushL( tempqueryList );
   449     ConvertQueryToListL(aSearchQuery, queryList);
   449     ConvertQueryToListL(aSearchQuery, queryList);
   450     
   450     
   451     // Remember a temporary copy of query list
   451     // Remember a temporary copy of query list
   452     // since we sort the queries
   452     // since we sort the queries
   453 	for( TInt i = 0; i < queryList.Count(); i++)
   453 	for ( TInt i = 0; i < queryList.Count(); i++)
   454 	{
   454 	{
   455 		tempqueryList.Append(queryList[i]);
   455 		tempqueryList.AppendL(queryList[i]);
   456 	}
   456 	}
   457          
   457          
   458 	// Sort the query items before we search them
   458 	// Sort the query items before we search them
   459 	TLinearOrder<HBufC> rule( CPcsAlgorithm1Utils::CompareByLength );
   459 	TLinearOrder<HBufC> rule( CPcsAlgorithm1Utils::CompareByLength );
   460 	queryList.Sort(rule);
   460 	queryList.Sort(rule);
   468 	{
   468 	{
   469 	    CPcsPoolElement* poolElement = static_cast<CPcsPoolElement*>(aSearchSet[index]);
   469 	    CPcsPoolElement* poolElement = static_cast<CPcsPoolElement*>(aSearchSet[index]);
   470 		CPsData* psData = poolElement->GetPsData();
   470 		CPsData* psData = poolElement->GetPsData();
   471 		psData->ClearDataMatches();
   471 		psData->ClearDataMatches();
   472 		
   472 		
       
   473         // Skip the contact if we are doing a group search and contact doesn't belong to the group
       
   474         if ( aIsSearchInGroup && 
       
   475              aContactsInGroup.Find( psData->Id() ) == KErrNotFound )
       
   476             {
       
   477             continue;
       
   478             }
       
   479         
   473 		TBool isMatch = ETrue;		
   480 		TBool isMatch = ETrue;		
   474 		TInt wordMatches = 0;
   481 		TInt wordMatches = 0;
   475 		
   482 		
   476 		// Reset iWordMatches to zero 
   483 		// Reset iWordMatches to zero 
   477 		ClearWordMatches();
   484 		ClearWordMatches();
   560 		
   567 		
   561 		// If match add the element to the result set
   568 		// If match add the element to the result set
   562 		//  And before adding to the result set, check if there is atleast one match per query
   569 		//  And before adding to the result set, check if there is atleast one match per query
   563 		if ( isMatch && wordMatches >= queryList.Count() )
   570 		if ( isMatch && wordMatches >= queryList.Count() )
   564 		{
   571 		{
   565 			if ( aIsSearchInGroup )
   572 			aAlgorithmFilterHelper->AddL(psData,tmpMatchSet);
   566 			{
       
   567 				if ( aContactsInGroup.Find(psData->Id()) != KErrNotFound )
       
   568 				{
       
   569 					aAlgorithmFilterHelper->AddL(psData,tmpMatchSet);
       
   570 				}
       
   571 			}
       
   572 			else 
       
   573 			{
       
   574 				aAlgorithmFilterHelper->AddL(psData,tmpMatchSet);
       
   575 			}
       
   576 	    } 
   573 	    } 
   577 	    
   574 	    
   578 	    // Cleanup the match sequence array as 
   575 	    // Cleanup the match sequence array as 
   579 		// they are stored in pattern details structure
   576 		// they are stored in pattern details structure
   580 		tmpMatchSet.ResetAndDestroy();
   577 		tmpMatchSet.ResetAndDestroy();