From: norbert b. <nor...@di...> - 2015-01-23 13:31:33
|
Hello, I would like to know if there is a way (in CLucene2.3.3.4) to build a Query* object from a complete Lucene query string, taking into account all of its operators (AND, OR, NOT, +, -, :, (), etc.). Until now, I've been able to use the QueryParser to build fairly simple queries, like this for example : /*******/ BooleanQuery* lBoolQuery = new BooleanQuery(); Query* lQuery1 = QueryParser::parse( _T( "sampleValue1" ), _T( "sampleField1" ), lAnalyzer ); Query* lQuery2 = QueryParser::parse( _T( "sampleValue2" ), _T( "sampleField2" ), lAnalyzer ); lBoolQuery ->add( lQuery1, true, BooleanClause::MUST ); lBoolQuery->add( lQuery2, true, BooleanClause::MUST ); /*******/ This works ok. But if I've got a complex Lucene string query, like : "title:(test -stuff) AND text:"hello wor*") OR "something nice"^4 ... How can I use this to get a Query* object representing this request ? I'm assuming there is a method to do that, I just can't find it. And I don't want to write a parser myself ! Thanks in advance, -- |