diff options
Diffstat (limited to 'src/mongo/db/fts/fts_query.h')
-rw-r--r-- | src/mongo/db/fts/fts_query.h | 109 |
1 files changed, 59 insertions, 50 deletions
diff --git a/src/mongo/db/fts/fts_query.h b/src/mongo/db/fts/fts_query.h index 88ca4ce64d0..10e0cd2faaf 100644 --- a/src/mongo/db/fts/fts_query.h +++ b/src/mongo/db/fts/fts_query.h @@ -40,68 +40,77 @@ namespace mongo { - namespace fts { - - class FTSQuery { - - public: - // Initializes an FTSQuery. Note that the parsing of "language" depends on the text - // index version, since a query which doesn't specify a language and is against a - // version 1 text index with a version 1 default language string needs to be parsed as - // version 1 (see fts_language.cpp for a list of language strings specific to version - // 1). - Status parse(const std::string& query, StringData language, bool caseSensitive, - TextIndexVersion textIndexVersion); - - const std::set<std::string>& getPositiveTerms() const { return _positiveTerms; } - const std::set<std::string>& getNegatedTerms() const { return _negatedTerms; } - const std::vector<std::string>& getPositivePhr() const { return _positivePhrases; } - const std::vector<std::string>& getNegatedPhr() const { return _negatedPhrases; } - - const std::set<std::string>& getTermsForBounds() const { - return _termsForBounds; - } +namespace fts { + +class FTSQuery { +public: + // Initializes an FTSQuery. Note that the parsing of "language" depends on the text + // index version, since a query which doesn't specify a language and is against a + // version 1 text index with a version 1 default language string needs to be parsed as + // version 1 (see fts_language.cpp for a list of language strings specific to version + // 1). + Status parse(const std::string& query, + StringData language, + bool caseSensitive, + TextIndexVersion textIndexVersion); + + const std::set<std::string>& getPositiveTerms() const { + return _positiveTerms; + } + const std::set<std::string>& getNegatedTerms() const { + return _negatedTerms; + } + const std::vector<std::string>& getPositivePhr() const { + return _positivePhrases; + } + const std::vector<std::string>& getNegatedPhr() const { + return _negatedPhrases; + } - const FTSLanguage& getLanguage() const { return *_language; } - bool getCaseSensitive() const { return _caseSensitive; } + const std::set<std::string>& getTermsForBounds() const { + return _termsForBounds; + } - std::string toString() const; + const FTSLanguage& getLanguage() const { + return *_language; + } + bool getCaseSensitive() const { + return _caseSensitive; + } - std::string debugString() const; + std::string toString() const; - BSONObj toBSON() const; + std::string debugString() const; - /** - * Lowercases "str" if _caseSensitive is set, else returns a copy of "str" unchanged. - */ - std::string normalizeString( StringData str ) const; + BSONObj toBSON() const; - static const bool caseSensitiveDefault; + /** + * Lowercases "str" if _caseSensitive is set, else returns a copy of "str" unchanged. + */ + std::string normalizeString(StringData str) const; - private: - void _addTerms( FTSTokenizer* tokenizer, - const std::string& tokens, - bool negated ); + static const bool caseSensitiveDefault; - const FTSLanguage* _language; - bool _caseSensitive; +private: + void _addTerms(FTSTokenizer* tokenizer, const std::string& tokens, bool negated); - // Positive terms. - std::set<std::string> _positiveTerms; + const FTSLanguage* _language; + bool _caseSensitive; - // Negated terms. - std::set<std::string> _negatedTerms; + // Positive terms. + std::set<std::string> _positiveTerms; - // Positive phrases. - std::vector<std::string> _positivePhrases; + // Negated terms. + std::set<std::string> _negatedTerms; - // Negated phrases. - std::vector<std::string> _negatedPhrases; + // Positive phrases. + std::vector<std::string> _positivePhrases; - // Terms for bounds. - std::set<std::string> _termsForBounds; - }; + // Negated phrases. + std::vector<std::string> _negatedPhrases; - } + // Terms for bounds. + std::set<std::string> _termsForBounds; +}; +} } - |