Skip to content

Commit

Permalink
fix(client): Add missing outputs (#465)
Browse files Browse the repository at this point in the history
Closes #444, #445, #446, #447, #454, #459
  • Loading branch information
ElPicador committed Feb 15, 2018
1 parent e77f6ee commit de24979
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/main/scala/algolia/responses/Indices.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ case class Index(name: String,
dataSize: Int,
fileSize: Int,
lastBuildTimeS: Int,
numberOfPendingTasks: Int,
pendingTask: Boolean)
6 changes: 5 additions & 1 deletion src/main/scala/algolia/responses/Logs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ case class Log(timestamp: String,
url: String,
ip: String,
query_headers: String,
sha1: String)
sha1: String,
nb_api_calls: String,
processing_time_ms: String,
query_nb_hits: String,
exhaustive: Boolean)

sealed trait LogType {

Expand Down
6 changes: 4 additions & 2 deletions src/main/scala/algolia/responses/SearchFacetResult.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

package algolia.responses

case class SearchFacetResult(facetHits: List[FacetHit])
case class SearchFacetResult(facetHits: List[FacetHit],
exhaustiveFacetsCount: Boolean,
processingTimeMS: Int)

case class FacetHit(value: String, highlighted: String, count: Integer)
case class FacetHit(value: String, highlighted: String, count: Int)
19 changes: 17 additions & 2 deletions src/main/scala/algolia/responses/SearchResult.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,17 @@ case class SearchResult(hits: Seq[JObject],
nbPages: Option[Int],
facets: Option[Map[String, Map[String, Int]]],
exhaustiveFacetsCount: Option[Boolean],
exhaustiveNbHits: Option[Boolean],
query: String,
queryAfterRemoval: Option[String],
params: String,
message: Option[String],
aroundLatLng: Option[String],
automaticRadius: Option[Int],
facets_stats: Option[Map[String, Float]],
// For getRankingInfo
serverUsed: Option[String],
parsedQuery: Option[String],
// For multiqueries
processed: Option[Boolean],
index: Option[String]) {
Expand Down Expand Up @@ -81,7 +90,10 @@ trait Hit extends ObjectID {

}

case class HighlightResult(value: String, matchLevel: String)
case class HighlightResult(value: String,
matchLevel: String,
matchedWords: Iterable[String],
fullyHighlighted: Boolean)

case class SnippetResult(value: String, matchLevel: String)

Expand All @@ -91,4 +103,7 @@ case class RankingInfo(nbTypos: Int,
userScore: Int,
geoDistance: Int,
geoPrecision: Int,
nbExactWords: Int)
nbExactWords: Int,
words: Int,
filters: Int,
matchedGeoLocation: Option[Map[String, Float]])
23 changes: 15 additions & 8 deletions src/test/scala/algolia/integration/SearchIntegrationTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,21 @@ class SearchIntegrationTest extends AlgoliaTest {

whenReady(s) { result =>
result.hits should have length 1
val hit = EnhanceTest("algolia",
10,
alien = false,
"563481290",
Some(Map("name" -> HighlightResult("<em>a</em>lgolia", "full"))),
None,
None,
None)
val hit = EnhanceTest(
"algolia",
10,
alien = false,
"563481290",
Some(
Map(
"name" -> HighlightResult("<em>a</em>lgolia",
"full",
Seq("a"),
fullyHighlighted = false))),
None,
None,
None
)
result.asHit[EnhanceTest].head should be(hit)
}
}
Expand Down

0 comments on commit de24979

Please sign in to comment.