Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Source based on 0.15.1 #54

Merged
merged 2 commits into from

2 participants

@holdenk

No description provided.

@adamalix adamalix merged commit 8657395 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 21, 2012
  1. @holdenk
  2. @holdenk

    bump version

    holdenk authored
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 6 deletions.
  1. +2 −2 build.sbt
  2. +7 −4 src/main/scala/com/foursquare/slashem/Schema.scala
View
4 build.sbt
@@ -1,6 +1,6 @@
name := "slashem"
-version := "0.14.3"
+version := "0.15.2"
organization := "com.foursquare"
@@ -131,4 +131,4 @@ ivyXML := (
<exclude module="jmxtools"/>
<exclude module="jmxri"/>
</dependencies>
-)
+)
View
11 src/main/scala/com/foursquare/slashem/Schema.scala
@@ -630,7 +630,9 @@ trait ElasticSchema[M <: Record[M]] extends SlashemSchema[M] {
val esHits = response.getHits().getHits()
val docs: Array[(Map[String,Any], Option[Map[String,java.util.ArrayList[String]]])] = esHits.map(doc => {
val m = doc.sourceAsMap()
- val annotedMap = (m.asScala ++ List("score" -> doc.score().toDouble)).toMap
+ //If a score is 0.0 this will blow up :(
+ val scoreDouble = doc.score().toDouble
+ val annotedMap = (m.asScala ++ List("score" -> scoreDouble)).toMap
val hlf = doc.getHighlightFields()
if (hlf == null) {
Pair(annotedMap,None)
@@ -747,11 +749,12 @@ trait ElasticSchema[M <: Record[M]] extends SlashemSchema[M] {
def scoreFields(query: ElasticQueryBuilder, fieldsToScore: List[ScoreBoost]): ElasticQueryBuilder = {
val scoredFields = fieldsToScore.map(_.elasticBoost)
val params = scoredFields.flatMap(_._1)
- val scriptSrc = scoredFields.map(_._2).mkString(" + ")
+ val scriptSrc = scoredFields.map(_._2).mkString(" * ")
val paramNames = (1 to params.length).map("p"+_)
val script = scriptSrc.format(paramNames:_*)
val namesAndParams = paramNames.zip(params).toMap
- val scoreScript = "_score * (1 +"+ script + " )"
+ //The ES client library breaks badly with low score values
+ val scoreScript = "1.0 + _score * "+ script + ""
scoreWithScript(query, scoreScript, namesAndParams, false)
}
@@ -1434,7 +1437,7 @@ class PointField[T <: Record[T]](override val owner: T) extends Field[Pair[Doubl
try {
a match {
case "" => Empty
- /*
+ /*
* GeoJSON has (long, lat) instead of (lat, long)
* Only ES uses GeoJSON spec and returns an ArrayList
*
Something went wrong with that request. Please try again.