Skip to content

Conversation

@markok4
Copy link

@markok4 markok4 commented Jun 12, 2025

Part of #91

@drmarjanovic
Copy link
Member

Another thing - change PR title as well as reference to the issue you're resolving.

…twith, endwith), Regex instead of String in intervalRegexp, remove useless imports
Comment on lines 559 to 560
* @param query
* the text to match in the intervals.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param query
* the text to match in the intervals.
* @param query
* the text to match in the intervals

Comment on lines 580 to 581
* @param prefix
* the prefix string to match.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param prefix
* the prefix string to match.
* @param prefix
* the prefix string to match

Comment on lines 788 to 799
/**
* Represents a `match` interval query. Matches analyzed text within intervals.
*
* @param query
* The text to match.
* @param analyzer
* Optional analyzer to use for this query.
* @param useField
* Optional alternative field used for term extraction.
*/

/** `match` interval-query */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here. We are using scaladoc only for public api methods.

* an instance of [[zio.elasticsearch.query.IntervalMatch]] that represents the `match` interval query.
*/

final def intervalMatch(query: String): IntervalMatch[String] =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have specific trait here as return type for methods here. (you can see other methods)

Copy link
Collaborator

@dbulaja98 dbulaja98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good first PR.

Few more things to do besides other comments:

  • Rename PR
  • Add IT tests
  • Add documentation

@markok4 markok4 changed the title Done: matches case for IntervalQuery (dsl): Support intervalQuery Jun 13, 2025
@markok4
Copy link
Author

markok4 commented Jun 17, 2025

I have a problem with scalafixAll and scalafmtAll, after formatting it tells me that everything is not formatted.

@@ -0,0 +1,30 @@
/*
* Copyright 2022 LambdaWorks
*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you resolved this comment, but I still see some strange chars here.

Comment on lines 31 to 35
Alternatively, you can pass a `Field` object directly:
```scala
val queryWithFieldObject: IntervalQuery[Document] =
intervals(field = "content", rule = intervalMatch("targetWord").useField(Document.stringField))
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like duplicate example of queryWithField.

Comment on lines 1 to 16
/*
* Copyright 2022 LambdaWorks
*
* 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.
*/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have resolved this comment, but you are still missing copyright here.

Comment on lines 178 to 179
query =
term(field = TestDocument.stringField, value = secondDocumentUpdated.stringField.toLowerCase)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also resolved, but there is still unnecessary change here.

}
/*
* Copyright 2022 LambdaWorks
*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still weird chars here.

/*
* Copyright 2022 LambdaWorks
*
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unnecessary

Comment on lines 4 to 12
* 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
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this

/*
* Copyright 2022 LambdaWorks
*
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix this file

dbulaja98
dbulaja98 previously approved these changes Jun 19, 2025
Copy link
Member

@drmarjanovic drmarjanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two additional notes:

  • website generating fails
  • tests fail for Scala 2.12 and Java 17

val docWithTerm = doc.copy(stringField = s"$term banana orange")

val query = intervals(
"stringField",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use TestDocument.stringField.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any issue with this?

val docWithTerm = doc.copy(stringField = s"$term banana orange")

val query = intervals(
"stringField",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any issue with this?

Copy link
Collaborator

@dbulaja98 dbulaja98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename ElasticIntervalQuery.scala and ElasticIntervalQuerySpec because it's actually rule, not query.
And, please add unit tests for the query itself

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be also renamed to Rule?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants