[SERVER-19510] Text query parsing should be moved to TextMatchExpression::init() Created: 21/Jul/15  Updated: 25/Nov/15  Resolved: 18/Nov/15

Status: Closed
Project: Core Server
Component/s: Querying, Text Search
Affects Version/s: None
Fix Version/s: 3.2.0-rc4

Type: Improvement Priority: Major - P3
Reporter: J Rassi Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-20888 $language in $text queries does not r... Closed
Related
is related to SERVER-18372 QuerySolution leak when exception is ... Closed
Backwards Compatibility: Minor Change
Sprint: QuInt B (11/02/15), QuInt C (11/23/15)
Participants:

 Description   

Parsing of text queries is currently performed as part of query execution stage building in StageBuilder::build(). This is a problem because StageBuilder::build() is not expected to fail.

This problem should be addressed by moving text query parsing to its natural home, TextMatchExpression::init(). Unfortunately, parsing text queries requires access to the collection's default language; thus, TextMatchExpression needs to be given access to a OperationContext that it can use to determine the default language. To accomplish this, a new argument should be added the MatchExpressionParser constructor of type MatchExpressionParser::TextCallback, which wraps an OperationContext* and exposes a public method parseText() (see the definition of MatchExpressionParser::WhereCallback, which exposes a similar mechanism).



 Comments   
Comment by J Rassi [ 18/Nov/15 ]

Introduces a minor backwards-breaking change: $text queries against an empty collection now return an error, instead of an empty result set.

3.2.0-rc2 behavior:

> db.foo.drop()
false
> db.foo.find({$text: {$search: "hello"}})
>

New behavior:

> db.foo.drop()
false
> db.foo.find({$text: {$search: "hello"}})
Error: error: {
	"waitedMS" : NumberLong(0),
	"ok" : 0,
	"errmsg" : "text index required for $text query (no such collection 'test.foo')",
	"code" : 27
}
>

Comment by Githook User [ 18/Nov/15 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-19510 Move text query parsing to TextMatchExpression::init()

  • Introduces FTSQuery, which is now the base class for FTSQueryImpl.
  • Introduces a derived class FTSQueryNoop (which
    TextNoOpMatchExpression now wraps). libfts_query_noop is now linked
    into db/matcher/expressions.
  • TextMatchExpression now parses the text query (which acquires a
    collection lock as part of the parsing process), and TextNode now
    stores a parsed version of the query. The FTSQuery::parse() call in
    buildStages() is removed.

Behavior change: $text against a non-existent collection now returns
an error, instead of an empty result set.
Branch: master
https://github.com/mongodb/mongo/commit/23136883e394b73cbc26f873cd0276779adef3df

Comment by Githook User [ 18/Nov/15 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-19510 Rename FTSQuery to FTSQueryImpl

Groundwork for upcoming change to introduce a "no-op" text query.
Branch: master
https://github.com/mongodb/mongo/commit/7bac6c8f64019082f205c7606c65f173972960a3

Comment by Githook User [ 18/Nov/15 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-19510 Fix include in rlp_language_test.cpp

Prep work for upcoming changes to src/mongo/db/fts/fts_query.h in
mongodb/mongo (attached to above ticket).
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/9c945c4b4fff141c66258379178a080dbe958658

Comment by Githook User [ 12/Nov/15 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-19510 Move ExtensionsCallback out of MatchExpressionParser
Branch: master
https://github.com/mongodb/mongo/commit/c051996996ae7e4f5f93cb38b1f140e0331fceb7

Comment by Githook User [ 12/Nov/15 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-19510 Refactor $text match expression parsing

Comment by Githook User [ 06/Nov/15 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-19510 Refactor WhereMatchExpression/WhereNoOpMatchExpression

  • Moves ExtensionsCallbackReal and ExtensionsCallbackNoop to their own
    files, and introduces a new library 'expressions_mongod_only' in
    db/matcher/.
  • Introduces a common base class for WhereMatchExpression and
    WhereNoOpMatchExpression.
  • Introduces a protected method extractWhereMatchExpressionParams() on
    ExtensionsCallback.
    Branch: master
    https://github.com/mongodb/mongo/commit/81aca0ec6827eaffd54c91af46f9041ce62587c4
Comment by Githook User [ 05/Nov/15 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-19510 ExtensionsCallbackReal ctor take ptr to NamespaceString
Branch: master
https://github.com/mongodb/mongo/commit/e2cbe3c873fa2f989e5c2b811b1757ac0f2095e3

Comment by Githook User [ 05/Nov/15 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-19510 Rename MatchExpressionParser::WhereCallback
Branch: master
https://github.com/mongodb/mongo/commit/3b76b83742bcd2124abe38718ad5c68bd72b2fc8

Generated at Thu Feb 08 03:51:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.