Hui v0.10.0 Hui.Query View Source
Hui.Query module provides underpinning HTTP-based request functions for Solr, including:
Link to this section Summary
Functions
Issues a get request of Solr query to a specific endpoint
Issues a POST update request to a specific Solr endpoint, for data indexing and deletion
Link to this section Types
Link to this type
faceting_struct()
View Source
faceting_struct() :: Hui.Query.Facet.t() | Hui.Query.FacetRange.t() | Hui.Query.FacetInterval.t()
Link to this type
highlighting_struct()
View Source
highlighting_struct() :: Hui.Query.Highlight.t() | Hui.Query.HighlighterUnified.t() | Hui.Query.HighlighterOriginal.t() | Hui.Query.HighlighterFastVector.t()
Link to this type
misc_struct()
View Source
misc_struct() :: Hui.Query.MoreLikeThis.t() | Hui.Query.Suggest.t() | Hui.Query.SpellCheck.t()
Link to this type
querying_struct()
View Source
querying_struct() :: Hui.Query.Standard.t() | Hui.Query.Common.t() | Hui.Query.DisMax.t()
Link to this type
solr_query()
View Source
solr_query() :: Keyword.t() | map() | solr_struct() | [solr_struct()]
Link to this type
solr_struct()
View Source
solr_struct() :: querying_struct() | faceting_struct() | highlighting_struct() | misc_struct()
Link to this type
solr_update_query()
View Source
solr_update_query() :: binary() | Hui.Query.Update.t()
Link to this section Functions
Link to this function
get(solr_url, solr_query)
View Source
get(solr_url(), solr_query()) :: {:ok, HTTPoison.Response.t()} | {:error, HTTPoison.Error.t()}
Issues a get request of Solr query to a specific endpoint.
The query can be a keyword list or a list of Hui query structs (solr_query/0).
Example - parameters
url = %Hul.URL{url: "http://..."}
# query via a list of keywords, which are unbound and sent to Solr directly
Hui.Query.get(url, q: "glen cova", facet: "true", "facet.field": ["type", "year"])
# query via Hui structs
alias Hui.Query
Hui.Query.get(url, %Query.DisMax{q: "glen cova"})
Hui.Query.get(url, [%Query.DisMax{q: "glen"}, %Query.Facet{field: ["type", "year"]}])
The use of structs is more idiomatic and succinct. It is bound to qualified Solr fields.
See Hui.URL.t/0 struct about specifying HTTP headers and HTTPoison options
of a request, e.g. timeout, recv_timeout, max_redirect etc.
Link to this function
post(solr_url, solr_query)
View Source
post(solr_url(), solr_update_query()) :: {:ok, HTTPoison.Response.t()} | {:error, HTTPoison.Error.t()}
Issues a POST update request to a specific Solr endpoint, for data indexing and deletion.