searchengine/cpix/cpix/src/qrytypes/cluceneqrytype.cpp
changeset 1 6f2c1c46032b
parent 0 671dee74050a
child 8 6547bf8ca13a
equal deleted inserted replaced
0:671dee74050a 1:6f2c1c46032b
    29 #include "iidxdb.h"
    29 #include "iidxdb.h"
    30 #include "initparams.h"
    30 #include "initparams.h"
    31 #include "cpixutil.h"
    31 #include "cpixutil.h"
    32 #include "iqrytype.h"
    32 #include "iqrytype.h"
    33 
    33 
    34 
    34 //Introduced for prefix optimization.
       
    35 #include "prefixopt.h"
       
    36 #include "cpixmaindefs.h"
       
    37 #include "iqrytype.h"
    35 
    38 
    36 namespace Cpix
    39 namespace Cpix
    37 {
    40 {
    38 
    41 
    39     /**
    42     /**
    82 
    85 
    83             if (args.size() > 0)
    86             if (args.size() > 0)
    84                 {
    87                 {
    85                     THROW_CPIXEXC(PL_ERROR "No arguments needed here");
    88                     THROW_CPIXEXC(PL_ERROR "No arguments needed here");
    86                 }
    89                 }
       
    90 
       
    91             //Can we do get rid of this parse here?
       
    92             clQuery_ = clQueryParser_->parse(qryStr);
       
    93             PrefixOptQueryRewriter prefixOpt_(OPTIMIZED_PREFIX_MAX_LENGTH, 
       
    94                                                     LCPIX_DEFAULT_FIELD, 
       
    95                                                     LCPIX_DEFAULT_PREFIX_FIELD );
       
    96             //Switch query ownership to stack and back
       
    97             std::auto_ptr<lucene::search::Query> q( clQuery_ ); clQuery_ = NULL; 
       
    98             clQuery_ = prefixOpt_.rewrite( q ).release();
    87             
    99             
    88             clQuery_ = clQueryParser_->parse(qryStr);
       
    89 
       
    90             if (clQuery_ == NULL)
   100             if (clQuery_ == NULL)
    91                 {
   101                 {
    92                     THROW_CPIXEXC("Query reduced to empty query.");
   102                     THROW_CPIXEXC("Query reduced to empty query.");
    93                 }
   103                 }
    94         }
   104         }