summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2013-03-16 02:27:42 -0400
committerDan Pasette <dan@10gen.com>2013-03-28 19:09:39 -0400
commit719d6d82077c24777b9bcf0048b65680bb8955e5 (patch)
tree27b8b1f148400e3656b9b6528f7e5b14d99cb97b
parentfde9ff094deccc27ef0701b8e46d8b3f35db3775 (diff)
downloadmongo-719d6d82077c24777b9bcf0048b65680bb8955e5.tar.gz
SERVER-8999 Read "indexPrefix" correctly in FTSCommand::_run()
-rw-r--r--jstests/fts_partition1.js3
-rw-r--r--src/mongo/db/fts/fts_command_mongod.cpp12
2 files changed, 9 insertions, 6 deletions
diff --git a/jstests/fts_partition1.js b/jstests/fts_partition1.js
index 7fa4aa40335..f1b4c437c3c 100644
--- a/jstests/fts_partition1.js
+++ b/jstests/fts_partition1.js
@@ -18,3 +18,6 @@ assert.eq( [ 1 ], queryIDS( t, "foo" , { x : 1 } ) );
res = t.runCommand( "text", { search : "foo" , filter : { x : 1 } } );
assert( res.results[0].score > 0, tojson( res ) )
+// repeat search with "language" specified, SERVER-8999
+res = t.runCommand( "text", { search : "foo" , filter : { x : 1 } , language : "english" } );
+assert( res.results[0].score > 0, tojson( res ) )
diff --git a/src/mongo/db/fts/fts_command_mongod.cpp b/src/mongo/db/fts/fts_command_mongod.cpp
index 979222cc72b..6fe534ad681 100644
--- a/src/mongo/db/fts/fts_command_mongod.cpp
+++ b/src/mongo/db/fts/fts_command_mongod.cpp
@@ -89,14 +89,14 @@ namespace mongo {
const IndexDetails& id = d->idx( idxMatches[0] );
BSONObj indexPrefix;
+ FTSIndex* ftsIndex = static_cast<FTSIndex*>(id.getSpec().getType());
if ( language == "" ) {
- FTSIndex* ftsIndex = static_cast<FTSIndex*>(id.getSpec().getType());
language = ftsIndex->getFtsSpec().defaultLanguage();
- Status s = ftsIndex->getFtsSpec().getIndexPrefix( filter, &indexPrefix );
- if ( !s.isOK() ) {
- errmsg = s.toString();
- return false;
- }
+ }
+ Status s = ftsIndex->getFtsSpec().getIndexPrefix( filter, &indexPrefix );
+ if ( !s.isOK() ) {
+ errmsg = s.toString();
+ return false;
}