Skip to content

Ease of query structs creation by Builder design pattern #16

@boonious

Description

@boonious

Solr provides extension ranges of request parameters. These are encapsulated in various Hui query structs, some of which are large and complex, e.g. the common parameters: https://github.com/boonious/hui/blob/master/lib/hui/query/common.ex

In addition to new functions that creates empty structs, modifier functions can be implemented in Builder design pattern to enable more idiomatic, stepwise construction of query structs e.g. with the use of pipe operator.

[Hui.Query.DisMax.new, Hui.Query.Common.new, Hui.Query.Facet.new]
|> q("apple", qf: "title^2.3 author description^0.4")
|> page(rows:10, start: 10, sort: "date desc")
|> fl("id,title,date,description,author,publisher,subject")
|> facet(field: ["author", "format"], query: "edited:true", pivot: "subject,format")

Tasks

  • implement modifier functions e.g. page, facet in query struct modules
  • create a helper module that matches and delegates modifier functions to corresponding query struct modules
  • documentation: update README and module doc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions