-
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
Sort and refactor methods #389
Conversation
weight = None | ||
) | ||
|
||
/** | ||
* Constructs an instance of [[zio.elasticsearch.query.RandomScoreFunction]] using the specified parameters. | ||
* [[zio.elasticsearch.query.RandomScoreFunction]] generates scores that are uniformly distributed from 0 up to but | ||
* not including 1. By default, it uses the internal Lucene doc IDs as a source of randomness, which is very efficient | ||
* not including 1. By default, it uses the internal Lucene doc ids as a source of randomness, which is very efficient |
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.
* not including 1. By default, it uses the internal Lucene doc ids as a source of randomness, which is very efficient | |
* not including 1. By default, it uses the internal Lucene doc IDs as a source of randomness, which is very efficient |
def filter[S1 <: S: Schema](filter: ElasticQuery[S1]): FieldValueFactor[S1] = | ||
FieldValueFactor[S1]( | ||
field = self.field, | ||
factor = self.factor, | ||
filter = Some(filter), | ||
modifier = self.modifier, | ||
missing = self.missing, | ||
weight = self.weight | ||
) |
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.
Could you use self.copy(filter = Some(filter))
?
def filter(value: ElasticQuery[Any]): FieldValueFactor[Any] = | ||
FieldValueFactor( | ||
field = self.field, | ||
factor = self.factor, | ||
filter = Some(value), | ||
modifier = self.modifier, | ||
missing = self.missing, | ||
weight = self.weight | ||
) |
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.
Here also.
@@ -627,6 +628,12 @@ private[elasticsearch] final case class RandomScoreFunction[S]( | |||
weight: Option[Double] | |||
) extends FunctionScoreFunction[S] { self => | |||
|
|||
def filter[S1 <: S: Schema](filter: ElasticQuery[S1]): RandomScoreFunction[S1] = | |||
RandomScoreFunction[S1](Some(filter), seedAndField, weight) |
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.
Name parameters.
val includes = if (included.isEmpty) Obj() else Obj("includes" -> Arr(included.map(_.toJson))) | ||
val excludes = if (excluded.isEmpty) Obj() else Obj("excludes" -> Arr(excluded.map(_.toJson))) | ||
Some(includes merge excludes) | ||
case (Chunk(), Chunk()) => None |
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.
I guess we can put None
in the new line, just to be consistent.
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.
We are. Everything is inlined here.
No description provided.