Skip to content

Commit

Permalink
Fix code remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
markaya committed May 25, 2023
1 parent d48fe33 commit faf44e7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ sealed trait FunctionScoreFunction[-S] {
* @param filter
* the [[zio.elasticsearch.query.ElasticQuery]] used for filtering
* @return
* an instance of [[zio.elasticsearch.query.FunctionScoreFunction]] that represents the function score query to be
* performed enriched with `filter` parameter.
* an instance of [[zio.elasticsearch.query.FunctionScoreFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] ] to be performed enriched with the `filter` parameter.
*/
def filter(filter: ElasticQuery[Any]): FunctionScoreFunction[Any]

Expand All @@ -45,10 +45,10 @@ sealed trait FunctionScoreFunction[-S] {
* @param filter
* the [[zio.elasticsearch.query.ElasticQuery]] used for filtering
* @tparam S1
* the type of query used in filter, requires implicit schema in scope
* the type of query used in filter, requires implicit [[zio.schema.Schema]] in scope
* @return
* an instance of [[zio.elasticsearch.query.FunctionScoreFunction]] that represents the function score query to be
* performed enriched with `filter` parameter.
* an instance of [[zio.elasticsearch.query.FunctionScoreFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed enriched with the `filter` parameter.
*/
def filter[S1 <: S: Schema](filter: ElasticQuery[S1]): FunctionScoreFunction[S1]

Expand All @@ -71,8 +71,8 @@ object FunctionScoreFunction {
* @param scale
* defines the distance from origin + offset at which the computed score will equal `decay` parameter
* @return
* an instance of [[zio.elasticsearch.query.DecayFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.DecayFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def expDecayFunction[S](field: Field[S, _], origin: String, scale: String): DecayFunction[S] =
DecayFunction[S](
Expand Down Expand Up @@ -101,8 +101,8 @@ object FunctionScoreFunction {
* @param scale
* defines the distance from origin + offset at which the computed score will equal `decay`
* @return
* an instance of [[zio.elasticsearch.query.DecayFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.DecayFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def expDecayFunction(field: String, origin: String, scale: String): DecayFunction[Any] =
DecayFunction[Any](
Expand All @@ -126,8 +126,8 @@ object FunctionScoreFunction {
* @param field
* the type-safe field to be extracted from the document
* @return
* an instance of [[zio.elasticsearch.query.FieldValueFactor]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.FieldValueFactor]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def fieldValueFactor[S](field: Field[S, _]): FieldValueFactor[S] =
FieldValueFactor[S](
Expand Down Expand Up @@ -175,8 +175,8 @@ object FunctionScoreFunction {
* @param scale
* defines the distance from origin + offset at which the computed score will equal `decay` parameter
* @return
* an instance of [[zio.elasticsearch.query.DecayFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.DecayFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def gaussDecayFunction[S](field: Field[S, _], origin: String, scale: String): DecayFunction[S] =
DecayFunction[S](
Expand Down Expand Up @@ -205,8 +205,8 @@ object FunctionScoreFunction {
* @param scale
* defines the distance from origin + offset at which the computed score will equal `decay`
* @return
* an instance of [[zio.elasticsearch.query.DecayFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.DecayFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def gaussDecayFunction(field: String, origin: String, scale: String): DecayFunction[Any] =
DecayFunction[Any](
Expand Down Expand Up @@ -235,8 +235,8 @@ object FunctionScoreFunction {
* @param scale
* defines the distance from origin + offset at which the computed score will equal `decay` parameter
* @return
* an instance of [[zio.elasticsearch.query.DecayFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.DecayFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def linearDecayFunction[S](field: Field[S, _], origin: String, scale: String): DecayFunction[S] =
DecayFunction[S](
Expand Down Expand Up @@ -265,8 +265,8 @@ object FunctionScoreFunction {
* @param scale
* defines the distance from origin + offset at which the computed score will equal `decay`
* @return
* an instance of [[zio.elasticsearch.query.DecayFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.DecayFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def linearDecayFunction(field: String, origin: String, scale: String): DecayFunction[Any] =
DecayFunction[Any](
Expand All @@ -288,8 +288,8 @@ object FunctionScoreFunction {
* but unfortunately not reproducible since documents might be renumbered by merges.
*
* @return
* an instance of [[zio.elasticsearch.query.RandomScoreFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.RandomScoreFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def randomScoreFunction(): RandomScoreFunction[Any] =
RandomScoreFunction(filter = None, seedAndField = None, weight = None)
Expand All @@ -303,8 +303,8 @@ object FunctionScoreFunction {
* @param seed
* the final score will be computed based on this value and default value for `field` which is "_seq_no"
* @return
* an instance of [[zio.elasticsearch.query.RandomScoreFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.RandomScoreFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def randomScoreFunction(seed: Long): RandomScoreFunction[Any] =
RandomScoreFunction(filter = None, seedAndField = Some(SeedAndField(seed = seed)), weight = None)
Expand All @@ -320,8 +320,8 @@ object FunctionScoreFunction {
* @param field
* the field value that will be used to compute final score
* @return
* an instance of [[zio.elasticsearch.query.RandomScoreFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.RandomScoreFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def randomScoreFunction(seed: Long, field: String): RandomScoreFunction[Any] =
RandomScoreFunction(
Expand All @@ -341,8 +341,8 @@ object FunctionScoreFunction {
* @param field
* the type-safe field for which [[zio.elasticsearch.query.RandomScoreFunction]] is specified for
* @return
* an instance of [[zio.elasticsearch.query.RandomScoreFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.RandomScoreFunction]] that can be used in
* [[zio.elasticsearch.query.FunctionScoreQuery] to be performed.
*/
def randomScoreFunction[S](seed: Long, field: Field[S, _]): RandomScoreFunction[S] =
RandomScoreFunction[S](
Expand Down Expand Up @@ -388,8 +388,8 @@ object FunctionScoreFunction {
* @param weight
* the number you wish to multiply the score with
* @return
* an instance of [[zio.elasticsearch.query.WeightFunction]] that represents the function score query to be
* performed.
* an instance of [[zio.elasticsearch.query.WeightFunction]] that can be used to in
* [[zio.elasticsearch.query.FunctionScoreQuery]].
*/
def weightFunction(weight: Double): WeightFunction[Any] =
WeightFunction(weight = weight, filter = None)
Expand All @@ -413,7 +413,7 @@ final case class DecayFunction[S](
* at the distance given at scale. If no decay is defined, documents at the distance scale will be scored 0.5.
*
* @param value
* the [[Double]] value for the `decay` parameter
* a non-negative real number value for the `decay` parameter
* @return
* an instance of [[zio.elasticsearch.query.DecayFunction]] enriched with the `decay` parameter.
*/
Expand Down Expand Up @@ -471,7 +471,7 @@ final case class DecayFunction[S](
* default is 0.
*
* @param value
* the [[String]] value for the `offset` parameter
* the text value for the `offset` parameter
* @return
* an instance of [[zio.elasticsearch.query.DecayFunction]] enriched with the `offset` parameter.
*/
Expand All @@ -483,7 +483,7 @@ final case class DecayFunction[S](
* multiply the score by the provided `weight`.
*
* @param value
* the [[Double]] value for the `weight` parameter
* a non-negative real number value for the `weight` parameter
* @return
* an instance of [[zio.elasticsearch.query.DecayFunction]] enriched with the `weight` parameter.
*/
Expand Down Expand Up @@ -530,7 +530,7 @@ final case class FieldValueFactor[S](
* field value with, defaults to 1.
*
* @param value
* the [[Double]] value for the `factor` parameter
* a non-negative real number value for the `factor` parameter
* @return
* an instance of [[zio.elasticsearch.query.FieldValueFactor]] enriched with the `factor` parameter.
*/
Expand Down Expand Up @@ -564,7 +564,7 @@ final case class FieldValueFactor[S](
* not have that field. The modifier and factor are still applied to it as though it were read from the document.
*
* @param value
* the [[Double]] value for the `missing` parameter
* a non-negative real number value for the `missing` parameter
* @return
* an instance of [[zio.elasticsearch.query.FieldValueFactor]] enriched with the `missing` parameter.
*/
Expand All @@ -576,7 +576,7 @@ final case class FieldValueFactor[S](
* multiply the score by the provided `weight`.
*
* @param value
* the [[Double]] value for the `weight` parameter
* a non-negative real number value for the `weight` parameter
* @return
* an instance of [[zio.elasticsearch.query.FieldValueFactor]] enriched with the `weight` parameter.
*/
Expand Down Expand Up @@ -633,7 +633,7 @@ private[elasticsearch] final case class RandomScoreFunction[S](
* multiply the score by the provided `weight`.
*
* @param value
* the [[Double]] value for the `weight` parameter
* a non-negative real number value for the `weight` parameter
* @return
* an instance of [[zio.elasticsearch.query.ScriptScoreFunction]] enriched with the `weight` parameter.
*/
Expand Down Expand Up @@ -669,7 +669,7 @@ private[elasticsearch] final case class ScriptScoreFunction[S](
* multiply the score by the provided `weight`.
*
* @param value
* the [[Double]] value for the `weight` parameter
* a non-negative real number value for the `weight` parameter
* @return
* an instance of [[zio.elasticsearch.query.RandomScoreFunction]] enriched with the `weight` parameter.
*/
Expand Down Expand Up @@ -771,6 +771,7 @@ object MultiValueMode {
}

private[elasticsearch] final case class SeedAndField(seed: Long, fieldName: String = SeedAndField.DefaultFieldName)

object SeedAndField {
private final val DefaultFieldName = "_seq_no"
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ sealed trait FunctionScoreQuery[S] extends ElasticQuery[S] with HasBoost[Functio
* [[zio.elasticsearch.query.FunctionScore]] query.
*
* @param functions
* list of [[zio.elasticsearch.query.FunctionScoreFunction]] to be added to query
* multiple [[zio.elasticsearch.query.FunctionScoreFunction]] to be added to query
* @tparam S1
* the type of the sub-queries, for which an implicit [[zio.schema.Schema]] is required
* @return
Expand Down Expand Up @@ -423,9 +423,9 @@ sealed trait HasChildQuery[S]
* the search results.
*
* @param value
* the [[scala.Int]] value for `score` parameter
* the [[scala.Int]] value for `maxChildren` parameter
* @return
* an instance of [[HasChildQuery]] with the `score` value set.
* an instance of [[HasChildQuery]] enriched with the `maxChildren` parameter.
*/
def maxChildren(value: Int): HasChildQuery[S]

Expand All @@ -435,9 +435,9 @@ sealed trait HasChildQuery[S]
* limit, it is excluded from the search results.
*
* @param value
* the [[scala.Int]] value for `score` parameter
* the [[scala.Int]] value for `minChildren` parameter
* @return
* an instance of [[HasChildQuery]] with the `score` value set.
* an instance of [[HasChildQuery]] enriched with the `minChildren` parameter.
*/
def minChildren(value: Int): HasChildQuery[S]
}
Expand Down Expand Up @@ -495,7 +495,7 @@ sealed trait HasParentQuery[S]
* @param value
* the [[scala.Boolean]] value for `score` parameter
* @return
* an instance of [[HasParentQuery]] with the `score` value set.
* an instance of [[HasParentQuery]] enriched with the `score` parameter.
*/
def withScore(value: Boolean): HasParentQuery[S]

Expand Down

0 comments on commit faf44e7

Please sign in to comment.