Skip to content

Commit 49512ce

Browse files
committed
added OnFieldsWithBoost() overload on QueryString query that only takes strings
1 parent 583575b commit 49512ce

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Nest/DSL/Query/QueryStringDescriptor.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,15 @@ public QueryStringDescriptor<T> OnFieldsWithBoost(
100100
});
101101
return this.OnFields(fieldNames);
102102
}
103-
103+
public QueryStringDescriptor<T> OnFieldsWithBoost(
104+
Action<FluentDictionary<string, double?>> boostableSelector)
105+
{
106+
var d = new FluentDictionary<string, double?>();
107+
boostableSelector(d);
108+
var fieldNames = d
109+
.Select(o => "{0}^{1}".F(o.Key, o.Value.GetValueOrDefault(1.0).ToString(CultureInfo.InvariantCulture)));
110+
return this.OnFields(fieldNames);
111+
}
104112

105113
public QueryStringDescriptor<T> Query(string query)
106114
{

0 commit comments

Comments
 (0)