From edb5f4efef0b5592f6e9449db86eca50223439ea Mon Sep 17 00:00:00 2001 From: Jason Rassi Date: Tue, 12 Mar 2013 10:30:21 -0400 Subject: SERVER-8873 Correctly decide if a term in a text field is a stopword --- src/mongo/db/fts/fts_index_format_test.cpp | 12 ++++++++++++ src/mongo/db/fts/fts_spec.cpp | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mongo/db/fts/fts_index_format_test.cpp b/src/mongo/db/fts/fts_index_format_test.cpp index 7b0f5b32f0a..5ef27dd83f5 100644 --- a/src/mongo/db/fts/fts_index_format_test.cpp +++ b/src/mongo/db/fts/fts_index_format_test.cpp @@ -91,6 +91,18 @@ namespace mongo { ASSERT( i.next().numberDouble() > 0 ); } + TEST( FTSIndexFormat, StopWords1 ) { + FTSSpec spec( FTSSpec::fixSpec( BSON( "key" << BSON( "data" << "text" ) ) ) ); + + BSONObjSet keys1; + FTSIndexFormat::getKeys( spec, BSON( "data" << "computer" ), &keys1 ); + ASSERT_EQUALS( 1U, keys1.size() ); + + BSONObjSet keys2; + FTSIndexFormat::getKeys( spec, BSON( "data" << "any computer" ), &keys2 ); + ASSERT_EQUALS( 1U, keys2.size() ); + } + } } diff --git a/src/mongo/db/fts/fts_spec.cpp b/src/mongo/db/fts/fts_spec.cpp index 89a9789f755..009aad2f70e 100644 --- a/src/mongo/db/fts/fts_spec.cpp +++ b/src/mongo/db/fts/fts_spec.cpp @@ -216,9 +216,9 @@ namespace mongo { string term = t.data.toString(); makeLower( &term ); - term = tools.stemmer->stem( term ); if ( tools.stopwords->isStopWord( term ) ) continue; + term = tools.stemmer->stem( term ); ScoreHelperStruct& data = terms[term]; -- cgit v1.2.1