LuceneObjectPtr PayloadTermQuery::clone(const LuceneObjectPtr& other) { LuceneObjectPtr clone = SpanQuery::clone(other ? other : newLucene<PayloadTermQuery>(term, function, includeSpanScore)); PayloadTermQueryPtr termQuery(boost::dynamic_pointer_cast<PayloadTermQuery>(clone)); termQuery->function = function; termQuery->includeSpanScore = includeSpanScore; return termQuery; }
WeightPtr PhraseQuery::createWeight(SearcherPtr searcher) { if (terms.size() == 1) // optimize one-term case { QueryPtr termQuery(newLucene<TermQuery>(terms[0])); termQuery->setBoost(getBoost()); return termQuery->createWeight(searcher); } return newLucene<PhraseWeight>(shared_from_this(), searcher); }