diff options
author | Jason Rassi <rassi@10gen.com> | 2014-02-13 12:55:48 -0500 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2014-02-13 12:55:48 -0500 |
commit | d8f7afc96a90ca3f158eebfe4ef3672a27788626 (patch) | |
tree | 332bf0eb9866645299c60221f18720ad2868c83a /src/mongo/db/fts/fts_matcher.cpp | |
parent | 82f354996edb1e6726de37aee0ca17947a55fe0b (diff) | |
download | mongo-d8f7afc96a90ca3f158eebfe4ef3672a27788626.tar.gz |
SERVER-12195 Text matcher should parse doc in doc language
This fixes the issue that the text matcher was incorrectly parsing
the document in the search language.
Diffstat (limited to 'src/mongo/db/fts/fts_matcher.cpp')
-rw-r--r-- | src/mongo/db/fts/fts_matcher.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mongo/db/fts/fts_matcher.cpp b/src/mongo/db/fts/fts_matcher.cpp index 45b455c2601..c9fad05f77f 100644 --- a/src/mongo/db/fts/fts_matcher.cpp +++ b/src/mongo/db/fts/fts_matcher.cpp @@ -40,8 +40,7 @@ namespace mongo { FTSMatcher::FTSMatcher( const FTSQuery& query, const FTSSpec& spec ) : _query( query ), - _spec( spec ), - _stemmer( query.getLanguage() ){ + _spec( spec ) { } /* @@ -61,7 +60,7 @@ namespace mongo { while ( it.more() ) { FTSIteratorValue val = it.next(); - if (_hasNegativeTerm_string( val._text )) { + if (_hasNegativeTerm_string( val._language, val._text )) { return true; } } @@ -73,14 +72,16 @@ namespace mongo { * Checks if any of the negTerms is in the tokenized string * @param raw, the raw string to be tokenized */ - bool FTSMatcher::_hasNegativeTerm_string( const string& raw ) const { + bool FTSMatcher::_hasNegativeTerm_string( const FTSLanguage* language, + const string& raw ) const { - Tokenizer i( _query.getLanguage(), raw ); + Tokenizer i( *language, raw ); + Stemmer stemmer( *language ); while ( i.more() ) { Token t = i.next(); if ( t.type != Token::TEXT ) continue; - string word = _stemmer.stem( tolowerString( t.data ) ); + string word = stemmer.stem( tolowerString( t.data ) ); if ( _query.getNegatedTerms().count( word ) > 0 ) return true; } |