File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,12 @@ func formatQualifiers(qs Qualifiers) []string {
147147
148148func formatKeywords (ks []string ) []string {
149149 for i , k := range ks {
150- ks [i ] = quote (k )
150+ before , after , found := strings .Cut (k , ":" )
151+ if ! found {
152+ ks [i ] = quote (k )
153+ } else {
154+ ks [i ] = fmt .Sprintf ("%s:%s" , before , quote (after ))
155+ }
151156 }
152157 return ks
153158}
Original file line number Diff line number Diff line change @@ -47,7 +47,14 @@ func TestQueryString(t *testing.T) {
4747 query : Query {
4848 Keywords : []string {"quote keywords" },
4949 },
50- out : "\" quote keywords\" " ,
50+ out : `"quote keywords"` ,
51+ },
52+ {
53+ name : "quotes keywords that are qualifiers" ,
54+ query : Query {
55+ Keywords : []string {"quote:keywords" , "quote:multiword keywords" },
56+ },
57+ out : `quote:keywords quote:"multiword keywords"` ,
5158 },
5259 {
5360 name : "quotes qualifiers" ,
@@ -56,7 +63,7 @@ func TestQueryString(t *testing.T) {
5663 Topic : []string {"quote qualifier" },
5764 },
5865 },
59- out : " topic:\ " quote qualifier\" " ,
66+ out : ` topic:"quote qualifier"` ,
6067 },
6168 }
6269 for _ , tt := range tests {
You can’t perform that action at this time.
0 commit comments