Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial stuff

  • Loading branch information...
commit 3c49d84df2983c8536a85321357b3bb6868cbd10 1 parent 242ad44
@adamalix adamalix authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/main/scala/com/foursquare/slashem/Schema.scala
View
11 src/main/scala/com/foursquare/slashem/Schema.scala
@@ -33,7 +33,6 @@ import org.elasticsearch.index.query.{AndFilterBuilder, CustomScoreQueryBuilder,
QueryBuilder => ElasticQueryBuilder}
import org.elasticsearch.node.Node
import org.elasticsearch.node.NodeBuilder._
-
import org.elasticsearch.search.facet.AbstractFacetBuilder
import org.elasticsearch.search.facet.terms.TermsFacetBuilder
import org.elasticsearch.search.facet.terms.strings.InternalStringTermsFacet
@@ -660,6 +659,16 @@ trait ElasticSchema[M <: Record[M]] extends SlashemSchema[M] {
new AndFilterBuilder(filters:_*)
}
+ def scoreWithScript(query: ElasticQueryBuilder,
+ scriptName: String,
+ namesAndParams: List[Pair[String, Any]]): ElasticQueryBuilder = {
+ val customScoreQuery = new CustomScoreQueryBuilder(query)
+ customScoreQuery.script(scriptName).lang("native")
+ for ((name, param) <- namesAndParams) {
+ customScoreQuery.param(name, param)
+ }
+ customScoreQuery
+ }
}
trait SolrSchema[M <: Record[M]] extends SlashemSchema[M] {
self: M with SlashemSchema[M] =>

0 comments on commit 3c49d84

Please sign in to comment.
Something went wrong with that request. Please try again.