-
Notifications
You must be signed in to change notification settings - Fork 18
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
Support last sort value and search after request #147
Conversation
@@ -72,6 +72,18 @@ object ElasticRequest { | |||
def getById(index: IndexName, id: DocumentId): GetByIdRequest = | |||
GetById(index = index, id = id, refresh = None, routing = None) | |||
|
|||
def searchAfter(index: IndexName, query: ElasticQuery[_], searchAfter: Json): SearchRequest = |
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.
Let's move this below search
.
@@ -382,10 +396,12 @@ object ElasticRequest { | |||
|
|||
val highlightsJson: Json = highlights.map(_.toJson).getOrElse(Obj()) | |||
|
|||
val searchAfterJson: Json = searchAfter.map(sa => Obj("search_after" -> sa)).getOrElse(Obj()) |
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.
Why not use fold
?
@@ -65,6 +67,8 @@ final class SearchResult private[elasticsearch] (private val hits: List[Item]) e | |||
} | |||
|
|||
def items: UIO[List[Item]] = ZIO.succeed(hits) | |||
|
|||
def lastSortValue(): ZIO[Any, Nothing, Option[Json]] = ZIO.succeed(lastSort) |
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.
Let's use UIO
here. Also, it can be lazy val
, right? Also, items
can be lazy val
.
@@ -404,6 +415,7 @@ object ElasticRequest { | |||
from: Option[Int], | |||
highlights: Option[Highlights], | |||
routing: Option[Routing], | |||
searchAfter: Option[Json], | |||
size: Option[Int] | |||
) extends SearchAndAggregateRequest { self => | |||
def from(value: Int): SearchAndAggregateRequest = |
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.
def highlights(value: Highlights): SearchAndAggregateRequest =
self.copy(highlights = Some(value))
Please provide this method in sealed trait SearchAndAggregateRequest
:
def highlights(value: Highlights): SearchAndAggregateRequest
No description provided.