class LuckySearch::SimpleQuery(T, K)

Defined in:

lucky_search/simple_query.cr

Constant Summary

COUNT = "count"
HITS = "hits"
ID = "_id"
SCORE = ["_score"]
SOURCE = "_source"
TOTAL = "total"
TYPE = "_document_type"
VALUE = "value"

Constructors

Instance Method Summary

Constructor Detail

def self.new(elastic_index : String? = nil, document_name : String? = nil) #

[View source]

Instance Method Detail

def client #

Yields the elasticsearch client


[View source]
def count(builder = Query.new) #

Performs a count query against an index


[View source]
def elastic_document_name : String #

Document type defaults to class name without namespace


[View source]
def elastic_index : String #

Index defaults to avram table name


[View source]
def generate_body(builder) #

[View source]
def query(q : String, params = {} of Symbol => String, filters = nil) #

[View source]
def query(params = {} of Symbol => String, filters = nil) #

Safely build the query


[View source]
def search(builder) #

Query elasticsearch with a query builder object


[View source]
def search(builder, &block : Proc(T, T?)) #

Query elasticsearch with a query builder object, accepts a formatter block Allows annotation/conversion of records using data from the model. Nils are removed from the list.


[View source]