Skip to content

Commit

Permalink
Replace List with Chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
mvelimir committed May 4, 2023
1 parent c1b7f18 commit cffb1ec
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,10 @@ object ElasticRequest {
index: IndexName,
query: ElasticQuery[_],
sortBy: Chunk[Sort],
excluded: Option[List[String]],
excluded: Option[Chunk[String]],
from: Option[Int],
highlights: Option[Highlights],
included: Option[List[String]],
included: Option[Chunk[String]],
routing: Option[Routing],
searchAfter: Option[Json],
size: Option[Int]
Expand All @@ -595,7 +595,7 @@ object ElasticRequest {
)

def excludes(field: String, fields: String*): SearchRequest =
self.copy(excluded = excluded.map(_ ++ (field +: fields)).orElse(Some(field +: fields.toList)))
self.copy(excluded = excluded.map(_ ++ (field +: fields)).orElse(Some(field +: Chunk.fromIterable(fields))))

def from(value: Int): SearchRequest =
self.copy(from = Some(value))
Expand All @@ -604,10 +604,10 @@ object ElasticRequest {
self.copy(highlights = Some(value))

def includes(field: String, fields: String*): SearchRequest =
self.copy(included = included.map(_ ++ (field +: fields)).orElse(Some(field +: fields.toList)))
self.copy(included = included.map(_ ++ (field +: fields)).orElse(Some(field +: Chunk.fromIterable(fields))))

def includes[A](implicit schema: Schema.Record[A]): SearchRequest = {
val fields = getFieldNames(schema)
val fields = Chunk.fromIterable(getFieldNames(schema))
self.copy(included = included.map(_ ++ fields).orElse(Some(fields)))
}

Expand Down Expand Up @@ -665,16 +665,16 @@ object ElasticRequest {
query: ElasticQuery[_],
aggregation: ElasticAggregation,
sortBy: Chunk[Sort],
excluded: Option[List[String]],
excluded: Option[Chunk[String]],
from: Option[Int],
highlights: Option[Highlights],
included: Option[List[String]],
included: Option[Chunk[String]],
routing: Option[Routing],
searchAfter: Option[Json],
size: Option[Int]
) extends SearchAndAggregateRequest { self =>
def excludes(field: String, fields: String*): SearchAndAggregateRequest =
self.copy(excluded = excluded.map(_ ++ (field +: fields)).orElse(Some(field +: fields.toList)))
self.copy(excluded = excluded.map(_ ++ (field +: fields)).orElse(Some(field +: Chunk.fromIterable(fields))))

def from(value: Int): SearchAndAggregateRequest =
self.copy(from = Some(value))
Expand All @@ -683,10 +683,10 @@ object ElasticRequest {
self.copy(highlights = Some(value))

def includes(field: String, fields: String*): SearchAndAggregateRequest =
self.copy(included = included.map(_ ++ (field +: fields)).orElse(Some(field +: fields.toList)))
self.copy(included = included.map(_ ++ (field +: fields)).orElse(Some(field +: Chunk.fromIterable(fields))))

def includes[A](implicit schema: Schema.Record[A]): SearchAndAggregateRequest = {
val fields = getFieldNames(schema)
val fields = Chunk.fromIterable(getFieldNames(schema))
self.copy(included = included.map(_ ++ fields).orElse(Some(fields)))
}

Expand Down

0 comments on commit cffb1ec

Please sign in to comment.