takezoe / solr-scala-client

Solr Client for Scala
Apache License 2.0
91 stars 43 forks source link

Add sortBy overload for multiple sorting fields #77

Closed caneroj1 closed 2 years ago

caneroj1 commented 2 years ago

The current implementation of sortBy does not allow for multiple sort fields and order to be specified for more advanced sorting use cases when ordering results.

This PR adds a new overload of sortBy that expects an Iterable[(String, Order)]. This is converted to a list of SortClause objects to be passed to setSorts when preparing the query.

takezoe commented 2 years ago

Thank you for contributing this!

How about adding a variable-length argument version of the method which takes (String, Order)* instead of Iterable[(String, Order)]? Other methods of QueryBuilderBase use variable-length argument to take multiple fields.

caneroj1 commented 2 years ago

Thank you for contributing this!

How about adding a variable-length argument version of the method which takes (String, Order)* instead of Iterable[(String, Order)]? Other methods of QueryBuilderBase use variable-length argument to take multiple fields.

Thanks for the suggestion. Removed Iterable and switched to variable-length args for consistency with other QueryBuildBase methods.

takezoe commented 2 years ago

Thank you!

caneroj1 commented 2 years ago

Thank you!

No problem! Hopefully a new version can be published soon :)

takezoe commented 2 years ago

@caneroj1 Just released 0.0.27. It will be available in Maven Central shortly.