Skip to content

Commit

Permalink
Fixed Formatting Issues
Browse files Browse the repository at this point in the history
Signed-off-by: GabeFernandez310 <[email protected]>
  • Loading branch information
GabeFernandez310 committed Nov 1, 2022
1 parent 8f1e7f7 commit 7add05f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions docs/user/dql/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2963,7 +2963,7 @@ Description

``query_string([field_expression+], query_expression[, option=<option_value>]*)``

The query_string function maps to the query_string query used in search engine (also used by `query`_), to return the documents that match a provided text, number, date or boolean value with a given field or fields.
The query_string function maps to the query_string query used in search engine, to return the documents that match a provided text, number, date or boolean value with a given field or fields.
The **^** lets you *boost* certain fields. Boosts are multipliers that weigh matches in one field more heavily than matches in other fields. The syntax allows to specify the fields in double quotes, single quotes, backticks or without any wrap. All fields search using star ``"*"`` is also available (star symbol should be wrapped). The weight is optional and should be specified after the field name, it could be delimeted by the `caret` character or by whitespace. Please refer to examples below:

| ``query_string(["Tags" ^ 2, 'Title' 3.4, `Body`, Comments ^ 0.3], ...)``
Expand Down Expand Up @@ -3025,7 +3025,7 @@ Description

``query("query_expression" [, option=<option_value>]*)``

This is an alternative syntax to the `query_string`_ function. The query function maps to the query_string query used in search engine, to return the documents that match a provided text, number, date or boolean value with a given field or fields.
The `query` function is an alternative syntax to the `query_string`_ function. It maps to the query_string query used in search engine, to return the documents that match a provided text, number, date or boolean value with a given query expression.
``query_expression`` must be a string provided in Lucene query string syntax. Please refer to examples below:

| ``query('Tags:taste OR Body:taste', ...)``
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ protected void checkValidArguments(String argNormalized, T queryBuilder) {
protected T loadArguments(List<NamedArgumentExpression> arguments) throws SemanticCheckException {
// Aggregate parameters by name, so getting a Map<Name:String, List>
arguments.stream().collect(Collectors.groupingBy(a -> a.getArgName().toLowerCase()))
.forEach((k, v) -> {
if (v.size() > 1) {
throw new SemanticCheckException(
String.format("Parameter '%s' can only be specified once.", k));
}
});
.forEach((k, v) -> {
if (v.size() > 1) {
throw new SemanticCheckException(
String.format("Parameter '%s' can only be specified once.", k));
}
});

T queryBuilder = createQueryBuilder(arguments);

Expand All @@ -64,9 +64,9 @@ protected T loadArguments(List<NamedArgumentExpression> arguments) throws Semant
checkValidArguments(argNormalized, queryBuilder);

(Objects.requireNonNull(
queryBuildActions
.get(argNormalized)))
.apply(queryBuilder, arg.getValue().valueOf(null));
queryBuildActions
.get(argNormalized)))
.apply(queryBuilder, arg.getValue().valueOf(null));
}

return queryBuilder;
Expand Down Expand Up @@ -102,5 +102,4 @@ public Map<String, QueryBuilderStep<T>> getQueryBuildActions() {
protected interface QueryBuilderStep<T extends QueryBuilder> extends
BiFunction<T, ExprValue, T> {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ public void relevanceSimple_query_string() {
+ "analyzer='keyword', operator='AND')"));
}


@Test
public void relevanceQuery_string() {
assertEquals(AstDSL.function("query_string",
Expand Down

0 comments on commit 7add05f

Please sign in to comment.