-
Couldn't load subscription status.
- Fork 1.5k
Add regex operator to Atlas Search #1587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
da79a5f
e560e43
05070a4
83d8646
8dbcb14
71de63f
ee5ae13
4e4cb10
be1b9fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Copyright 2008-present MongoDB, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.mongodb.client.model.search; | ||
|
|
||
| import com.mongodb.annotations.Beta; | ||
| import com.mongodb.annotations.Reason; | ||
| import com.mongodb.annotations.Sealed; | ||
|
|
||
| /** | ||
| * @see SearchOperator#regex(SearchPath, String) | ||
| * @see SearchOperator#regex(Iterable, Iterable) | ||
| * @since 5.3 | ||
| */ | ||
|
|
||
| @Sealed | ||
| @Beta(Reason.CLIENT) | ||
| public interface RegexSearchOperator extends SearchOperator { | ||
| @Override | ||
| RegexSearchOperator score(SearchScore modifier); | ||
|
|
||
| /** | ||
| * Creates a new {@link RegexSearchOperator} that uses allowAnalyzedField. | ||
| * | ||
| * @param isAllowed The boolean to run the query against an analyzed field. | ||
| * @return A new {@link RegexSearchOperator}. | ||
| * | ||
| * @mongodb.atlas.manual atlas-search/allowAnalyzedField/ allowAnalyzedField mappings | ||
| */ | ||
| RegexSearchOperator allowAnalyzedField(boolean isAllowed); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,7 +31,7 @@ | |||||||||||||
| final class SearchConstructibleBsonElement extends AbstractConstructibleBsonElement<SearchConstructibleBsonElement> implements | ||||||||||||||
| MustCompoundSearchOperator, MustNotCompoundSearchOperator, ShouldCompoundSearchOperator, FilterCompoundSearchOperator, | ||||||||||||||
| ExistsSearchOperator, TextSearchOperator, AutocompleteSearchOperator, | ||||||||||||||
| NumberNearSearchOperator, DateNearSearchOperator, GeoNearSearchOperator, | ||||||||||||||
| NumberNearSearchOperator, DateNearSearchOperator, GeoNearSearchOperator, RegexSearchOperator, | ||||||||||||||
| ValueBoostSearchScore, PathBoostSearchScore, ConstantSearchScore, FunctionSearchScore, | ||||||||||||||
| GaussSearchScoreExpression, PathSearchScoreExpression, | ||||||||||||||
| FacetSearchCollector, | ||||||||||||||
|
|
@@ -88,6 +88,11 @@ public TextSearchOperator synonyms(final String name) { | |||||||||||||
| }); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| @Override | ||||||||||||||
| public RegexSearchOperator allowAnalyzedField(final boolean isAllowed) { | ||||||||||||||
| return newWithAppendedValue("allowAnalyzedField", notNull("isAllowed", isAllowed)); | ||||||||||||||
| } | ||||||||||||||
|
||||||||||||||
| public RegexSearchOperator allowAnalyzedField(final boolean isAllowed) { | |
| return newWithAppendedValue("allowAnalyzedField", notNull("isAllowed", isAllowed)); | |
| } | |
| public RegexSearchOperator allowAnalyzedField(final boolean allowAnalyzedField) { | |
| return newWithAppendedValue("allowAnalyzedField", allowAnalyzedField); | |
| } |
Redundant null check. For naming, a similar method uses the same param name as the method itself:
public SearchOptions returnStoredSource(final boolean returnStoredSource) {
return newAppended("returnStoredSource", new BsonBoolean(returnStoredSource));
}
This can be changed in the interfaces as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done