searchengine/cpix/cpix/inc/private/prefixopt.h
changeset 1 6f2c1c46032b
equal deleted inserted replaced
0:671dee74050a 1:6f2c1c46032b
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PREFIXOPT_H_
       
    19 #define PREFIXOPT_H_
       
    20 
       
    21 #include <string>
       
    22 #include <wchar.h>
       
    23 
       
    24 // Forward declarations
       
    25 namespace lucene { 
       
    26 	namespace search {
       
    27 		class Query;  
       
    28 	}
       
    29 }
       
    30 
       
    31 namespace Cpix 
       
    32 {
       
    33 
       
    34 	/**
       
    35 	 * Goes throught the query hiearchy and converts queries of 
       
    36 	 * form "field:c*" into form "field_prefix:c".
       
    37 	 * 
       
    38 	 */
       
    39 	class PrefixOptQueryRewriter
       
    40 	{
       
    41 		public:
       
    42 		
       
    43 			PrefixOptQueryRewriter(int maxPrefixLength, 
       
    44 								   const wchar_t* optimizedField, 
       
    45 								   const wchar_t* prefixField);
       
    46 			
       
    47 			~PrefixOptQueryRewriter();
       
    48 		
       
    49 			std::auto_ptr<lucene::search::Query>
       
    50 				rewrite(std::auto_ptr<lucene::search::Query> query);
       
    51 			
       
    52 		private: 
       
    53 			
       
    54 			int maxPrefixLength_; 
       
    55 			
       
    56 			std::wstring optimizedField_; 
       
    57 			
       
    58 			std::wstring prefixField_;
       
    59 			
       
    60 	};
       
    61 
       
    62 }
       
    63 
       
    64 #endif /* PREFIXOPT_H_ */