diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MongoFullTextSearchQueryUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MongoDBTextFilterUsage.java
similarity index 76%
rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MongoFullTextSearchQueryUsage.java
rename to error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MongoDBTextFilterUsage.java
index 60dbdab8506..77208f673e8 100644
--- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MongoFullTextSearchQueryUsage.java
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MongoDBTextFilterUsage.java
@@ -17,26 +17,26 @@
import com.sun.source.tree.MethodInvocationTree;
/**
- * A {@link BugChecker} that flags usages of Mongo {@code $text} filters used for full text
- * searches.
+ * A {@link BugChecker} that flags usages of MongoDB {@code $text} filter usages.
*
- * @see Mongo Text Search
+ * @see MongoDB Text Search
*/
@AutoService(BugChecker.class)
@BugPattern(
- summary = "Avoid the `$text` operator in Mongo's full-text search queries",
- link = BUG_PATTERNS_BASE_URL + "MongoFullTextSearchQueryUsage",
+ summary =
+ "Avoid MongoDB's `$text` filter operator, as it can trigger heavy queries and even cause the server to run out of memory",
+ link = BUG_PATTERNS_BASE_URL + "MongoDBTextFilterUsage",
linkType = CUSTOM,
severity = SUGGESTION,
tags = PERFORMANCE)
-public final class MongoFullTextSearchQueryUsage extends BugChecker
+public final class MongoDBTextFilterUsage extends BugChecker
implements MethodInvocationTreeMatcher {
private static final long serialVersionUID = 1L;
private static final Matcher MONGO_FILTERS_TEXT_METHOD =
staticMethod().onClass("com.mongodb.client.model.Filters").named("text");
- /** Instantiates a new {@link MongoFullTextSearchQueryUsage} instance. */
- public MongoFullTextSearchQueryUsage() {}
+ /** Instantiates a new {@link MongoDBTextFilterUsage} instance. */
+ public MongoDBTextFilterUsage() {}
@Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/MongoFullTextSearchQueryUsageTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/MongoDBTextFilterUsageTest.java
similarity index 72%
rename from error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/MongoFullTextSearchQueryUsageTest.java
rename to error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/MongoDBTextFilterUsageTest.java
index 2677c0dbb42..ea9ca288a89 100644
--- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/MongoFullTextSearchQueryUsageTest.java
+++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/MongoDBTextFilterUsageTest.java
@@ -3,10 +3,10 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
-final class MongoFullTextSearchQueryUsageTest {
+final class MongoDBTextFilterUsageTest {
@Test
void identification() {
- CompilationTestHelper.newInstance(MongoFullTextSearchQueryUsage.class, getClass())
+ CompilationTestHelper.newInstance(MongoDBTextFilterUsage.class, getClass())
.addSourceLines(
"A.java",
"import com.mongodb.client.model.Filters;",
@@ -19,8 +19,6 @@ void identification() {
" Filters.text(\"foo\");",
" // BUG: Diagnostic contains:",
" Filters.text(\"foo\", new TextSearchOptions());",
- " // BUG: Diagnostic contains:",
- " Filters.text(\"foo\", new TextSearchOptions().caseSensitive(true));",
" }",
"}")
.doTest();
diff --git a/pom.xml b/pom.xml
index 2d70b4a1dd2..02757422a8a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -446,11 +446,9 @@
org.mongodb
mongodb-driver-core
- 4.9.1
-
+ 4.10.2
+
org.mongodb