Skip to content
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

(dsl): Support matchPhrasePrefix query #301

Merged

Conversation

milicns
Copy link
Contributor

@milicns milicns commented Aug 14, 2023

Part of #91

title: "Match Phrase Prefix Query"
---

The `MatchPhrasePrefix` returns documents that contain the words of a provided text, in the same order as provided.
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
The `MatchPhrasePrefix` returns documents that contain the words of a provided text, in the same order as provided.
The `MatchPhrasePrefix` query returns documents that contain the words of a provided text, in the same order as provided.

val query: MatchPhrasePrefixQuery = matchPhrasePrefix(field = Document.stringField, value = "test")
```

You can find more information about `MatchPhrasePrefix` query [here](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/query-dsl-match-query-phrase-prefix.html).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put empty line at the end of the file.

value = s"${firstDocument.stringField} te"
)
res <- Executor.execute(ElasticRequest.search(firstSearchIndex, query)).documentAs[TestDocument]
} yield assert(res)(Assertion.contains(document))
Copy link
Collaborator

@dbulaja98 dbulaja98 Aug 15, 2023

Choose a reason for hiding this comment

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

Maybe you can add && !contains(...) for other document?

* @param field
* the type-safe field for which query is specified for
* @param value
* the value to be matched, represented by an instance of type `String`
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
* the value to be matched, represented by an instance of type `String`
* the text value to be matched

* @param field
* the field for which query is specified for
* @param value
* the value to be matched, represented by an instance of type `String`
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
* the value to be matched, represented by an instance of type `String`
* the text value to be matched

Comment on lines 589 to 593
private[elasticsearch] final case class MatchPhrasePrefix[S](field: String, value: String)
extends MatchPhrasePrefixQuery[S] {
private[elasticsearch] def toJson(fieldPath: Option[String]): Json =
Obj("match_phrase_prefix" -> Obj(fieldPath.foldRight(field)(_ + "." + _) -> value.toJson))
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put empty line between.

Comment on lines 898 to 900
assert(queryTs)(
equalTo(MatchPhrasePrefix[TestDocument](field = "stringField", value = "test"))
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be in one line?

@milicns milicns requested a review from dbulaja98 August 15, 2023 11:21
dbulaja98
dbulaja98 previously approved these changes Aug 16, 2023
dbulaja98
dbulaja98 previously approved these changes Aug 16, 2023
@dbulaja98 dbulaja98 merged commit bf0b0c2 into lambdaworks:main Aug 17, 2023
13 checks passed
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.

3 participants