Browse files

Updated search tests to remove deprecated functionality

  • Loading branch information...
1 parent e4795ba commit 5c1da41fb7723eedf924824ef0fbdee700b24640 @sksamuel sksamuel committed Jan 29, 2014
Showing with 3 additions and 17 deletions.
  1. +3 −17 src/test/scala/com/sksamuel/elastic4s/SearchDslTest.scala
View
20 src/test/scala/com/sksamuel/elastic4s/SearchDslTest.scala
@@ -90,7 +90,7 @@ class SearchDslTest extends FlatSpec with MockitoSugar with OneInstancePerTest {
it should "generate json for a string query" in {
val json = mapper.readTree(getClass.getResource("/com/sksamuel/elastic4s/search_string.json"))
val req = search in "*" types("users", "tweets") limit 5 query {
- query("coldplay") allowLeadingWildcard true analyzeWildcard true anaylyzer WhitespaceAnalyzer autoGeneratePhraseQueries true defaultField "name" boost 6.5 enablePositionIncrements true fuzzyMaxExpansions 4 fuzzyMinSim 0.9 fuzzyPrefixLength 3 lenient true phraseSlop 10 tieBreaker 0.5 operator "OR" rewrite "writer"
+ query("coldplay") allowLeadingWildcard true analyzeWildcard true anaylyzer WhitespaceAnalyzer autoGeneratePhraseQueries true defaultField "name" boost 6.5 enablePositionIncrements true fuzzyMaxExpansions 4 fuzzyPrefixLength 3 lenient true phraseSlop 10 tieBreaker 0.5 operator "OR" rewrite "writer"
} searchType SearchType.DfsQueryThenFetch
assert(json === mapper.readTree(req._builder.toString))
}
@@ -165,7 +165,7 @@ class SearchDslTest extends FlatSpec with MockitoSugar with OneInstancePerTest {
it should "generate json for a fuzzy query" in {
val json = mapper.readTree(getClass.getResource("/com/sksamuel/elastic4s/search_fuzzy.json"))
val req = search in "*" types("users", "tweets") limit 5 query {
- fuzzy("drummmer", "will") boost 4 maxExpansions 10 prefixLength 10 transpositions true minSimilarity 2.2
+ fuzzy("drummmer", "will") boost 4 maxExpansions 10 prefixLength 10 transpositions true
} searchType SearchType.Count
assert(json === mapper.readTree(req._builder.toString))
}
@@ -250,20 +250,6 @@ class SearchDslTest extends FlatSpec with MockitoSugar with OneInstancePerTest {
assert(json === mapper.readTree(req._builder.toString))
}
- it should "generate json for a field query" in {
- val json = mapper.readTree(getClass.getResource("/com/sksamuel/elastic4s/search_field.json"))
- val req = search("*").types("bands", "artists").limit(5).bool(
- must(
- field("name",
- "coldplay") allowLeadingWildcard true analyzeWildcard false boost 5 fuzzyPrefixLength 5 phraseSlop 9,
- field("status",
- "awesome") analyzer PatternAnalyzer autoGeneratePhraseQueries true enablePositionIncrements true,
- field("location", "oxford") fuzzyMinSim 0.5 fuzzyMaxExpansions 7 rewrite "rewrite"
- )
- ) preference Preference.OnlyNode("a")
- assert(json === mapper.readTree(req._builder.toString))
- }
-
it should "generate json for a match phrase query" in {
val json = mapper.readTree(getClass.getResource("/com/sksamuel/elastic4s/search_match_phrase.json"))
val req = search("*").types("bands", "artists").limit(5).query {
@@ -552,7 +538,7 @@ class SearchDslTest extends FlatSpec with MockitoSugar with OneInstancePerTest {
it should "generate correct json for flt query" in {
val json = mapper.readTree(getClass.getResource("/com/sksamuel/elastic4s/search_query_flt.json"))
val req = search in "music" types "bands" query {
- fuzzylikethis text "text like this one" fields("name", "location") analyzer WhitespaceAnalyzer ignoreTF true prefixLength 4 maxQueryTerms 2 minSimilarity 0.4 boost 1.2
+ fuzzylikethis text "text like this one" fields("name", "location") analyzer WhitespaceAnalyzer ignoreTF true prefixLength 4 maxQueryTerms 2 boost 1.2
}
assert(json === mapper.readTree(req._builder.toString))
}

0 comments on commit 5c1da41

Please sign in to comment.