All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sksamuel.elastic4s.searches.queries.DisMaxBuilderFn.scala Maven / Gradle / Ivy

The newest version!
package com.sksamuel.elastic4s.searches.queries

import com.sksamuel.elastic4s.searches.QueryBuilderFn
import org.elasticsearch.index.query.{DisMaxQueryBuilder, QueryBuilders}

object DisMaxBuilderFn {
  def apply(q: DisMaxQueryDefinition): DisMaxQueryBuilder = {
    val builder = QueryBuilders.disMaxQuery()
    q.queries.foreach(q => builder.add(QueryBuilderFn(q)))
    q.boost.map(_.toFloat).foreach(builder.boost)
    q.tieBreaker.map(_.toFloat).foreach(builder.tieBreaker)
    q.queryName.foreach(builder.queryName)
    builder
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy