Search now apply to all fields by default

This commit is contained in:
2020-08-21 17:04:14 +02:00
parent 372652d332
commit 8ba89d3e05
6 changed files with 71 additions and 24 deletions
@@ -13,7 +13,8 @@ internal class SearchTermsParserKtTest {
title: String? = null,
tag: String? = null,
content: String? = null,
): Pair<String, SearchTerms> = input to SearchTerms(title, tag, content)
all: String? = null
): Pair<String, SearchTerms> = input to SearchTerms(title, tag, content, all)
@Suppress("Unused")
private fun results() = Stream.of(
@@ -21,13 +22,13 @@ internal class SearchTermsParserKtTest {
createResult("title:'example with words'", title = "example with words"),
createResult("title:'example with words'", title = "example with words"),
createResult("""title:"double quotes"""", title = "double quotes"),
createResult("title:'example' something else", title = "example", content = "something else"),
createResult("title:'example' something else", title = "example", all = "something else"),
createResult("tag:'example'", tag = "example"),
createResult("tag:'example' title:'other'", title = "other", tag = "example"),
createResult("blah blah tag:'example' title:'other'", title = "other", tag = "example", content = "blah blah"),
createResult("tag:'example' middle title:'other'", title = "other", tag = "example", content = "middle"),
createResult("tag:'example' title:'other' end", title = "other", tag = "example", content = "end"),
createResult("tag:'example abc' title:'other with words' this is the end ", title = "other with words", tag = "example abc", content = "this is the end"),
createResult("blah blah tag:'example' title:'other'", title = "other", tag = "example", all = "blah blah"),
createResult("tag:'example' middle title:'other'", title = "other", tag = "example", all = "middle"),
createResult("tag:'example' title:'other' end", title = "other", tag = "example", all = "end"),
createResult("tag:'example abc' title:'other with words' this is the end ", title = "other with words", tag = "example abc", all = "this is the end"),
)
@ParameterizedTest