Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hlquery logo

A modular Ruby client library for hlquery, designed with a familiar and intuitive API structure.

Follow hlquery Ruby build GitHub hlquery License

What is the hlquery Ruby API?

The hlquery Ruby API is the official Ruby client for hlquery. It mirrors the practical endpoint coverage of the other hlquery clients while exposing Ruby-style method names and service objects.

It is intended for scripts, services, internal tools, and apps that want a small Ruby wrapper over hlquery's HTTP interface.

Why use it?

Use it when you want a cleaner Ruby interface than hand-written Net::HTTP calls, with consistent auth, params, parsed response handling, and coverage for collections, documents, search, and custom route access.

Install

Local usage:

$LOAD_PATH.unshift(File.expand_path("lib", __dir__))
require "hlquery"

Client initialization:

client = Hlquery::Client.new(ENV["HLQ_BASE_URL"] || ENV["HLQUERY_BASE_URL"] || "http://localhost:9200")

Quick Start

$LOAD_PATH.unshift(File.expand_path("lib", __dir__))
require "hlquery"

client = Hlquery::Client.new("http://localhost:9200")

health = client.health
puts "status: #{health.body["status"] || "ok"}" if health.success?

collections = client.list_collections(0, 10)
puts collections.body.inspect

Auth

client = Hlquery::Client.new("http://localhost:9200", {
  token: "your_token_here",
  auth_method: "bearer"
})

client.set_auth_token("your_token_here", "bearer")
client.set_auth_token("your_api_key_here", "api-key")

Search

results = client.search("products", {
  "q" => "waterproof jacket",
  "limit" => 10
})

If q is set and query_by is omitted, the client tries to infer query_by from the collection's searchable_fields.

Contributing

We welcome contributions from the community! All contributions must be released under the BSD 3-Clause license.

How to Contribute

  • Check existing Ruby API issues or create new ones
  • Contribute Ruby client changes to hlquery/ruby-api
  • Contribute shared server/API changes to hlquery/hlquery
  • Test and report bugs against the Ruby client
  • Improve Ruby-specific documentation and examples

Search all collections

result = client.search_all(q: "research", limit: 20)
selected = client.search_all(body: { q: "research", collections: %w[universities science] })

global_search remains available as an equivalent name. Results are globally merged and each hit includes document._collection.

Community

License

The hlquery Ruby API is licensed under the BSD 3-Clause License.

About

Ruby client library for hlquery with modular APIs, auth support, and type-safe responses.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages