Reputation: 8747
LocalParams
is really just a Dictionary<string, string>
behind the scenes.
However, I want to pass multiple Boost Queries, which use the key "bq". Obviously, any attempt to add my second "bq" key will fail with An item with the same key has already been added.
var lp = new LocalParams();
lp.Add("bq", "ContentType:Update^3.0");
lp.Add("bq", "ContentType:Comment^0.5"); // Error occurs here...
What's the trick to passing multiple Boost Queries (or multiple anything, really)...
Upvotes: 0
Views: 690
Reputation: 8747
The comment above set me onto ExtraParams.
I thought it wouldn't work since that was a Dictionary<string, string>
(thus leaving me in the same situation), but the actual property definition is IEnumerable<KeyValuePair<string, string>>
. It's just set to a Dictionary<string,string>
in the constructor.
So I did this:
var extraParams = new List<KeyValuePair<string, string>>();
extraParams.Add(new KeyValuePair<string, string>("bq", "SomeQuery^10"));
extraParams.Add(new KeyValuePair<string, string>("bq", "SomeOtherQuery^10"));
var options new new QueryOptions();
options.ExtraParams = extraParams; //Since my List implements the right interface
solr.Query(myQuery, options)
My testing shows that it works as intended.
Upvotes: 2