mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-25 14:34:33 +01:00
22 lines
508 B
Elixir
22 lines
508 B
Elixir
defmodule Philomena.Galleries.Query do
|
|
alias PhilomenaQuery.Parse.Parser
|
|
|
|
defp fields do
|
|
[
|
|
int_fields: ~W(id image_count watcher_count),
|
|
literal_fields: ~W(title user image_ids watcher_ids),
|
|
date_fields: ~W(created_at updated_at),
|
|
ngram_fields: ~W(description),
|
|
default_field: {"title", :term},
|
|
aliases: %{
|
|
"user" => "creator"
|
|
}
|
|
]
|
|
end
|
|
|
|
def compile(query_string) do
|
|
fields()
|
|
|> Parser.new()
|
|
|> Parser.parse(query_string)
|
|
end
|
|
end
|