(parse-form form
&
{:keys [analyzer mode]
:or {analyzer (analysis/standard-analyzer) mode :query}})
Parses form, returning an org.apache.lucene.search.Query.
The form is parsed according to the following rules:
org.apache.lucene.search.Query => as is [query1 query2] => query1 AND query2 #{query1 query2} => query1 OR query2 {:field "value"} => query(field:value)
Options:
{:analyzer An org.apache.lucene.analysis.Analyzer instance used for building query from string, default (clucie.analysis/standard-analyzer). :mode Changes the behavior of parsing string, default :query. <:query|:phrase-query|:wildcard-query|:qp-query>}
You can extend the behavior of parse-form by implementing parse-formt of FormParsable protocol. For example,
(extend-protocol clucie.query/FormParsable java.util.regex.Pattern (parse-formt [re {:keys [key]}] (org.apache.lucene.search.RegexpQuery. (org.apache.lucene.index.Term. (stringify-value key) (.pattern re)))))
adds a new rule that builds an org.apache.lucene.search.RegexpQuery from a regexp.
Parses form, returning an org.apache.lucene.search.Query. The form is parsed according to the following rules: org.apache.lucene.search.Query => as is [query1 query2] => query1 AND query2 #{query1 query2} => query1 OR query2 {:field "value"} => query(field:value) Options: {:analyzer An org.apache.lucene.analysis.Analyzer instance used for building query from string, default (clucie.analysis/standard-analyzer). :mode Changes the behavior of parsing string, default :query. <:query|:phrase-query|:wildcard-query|:qp-query>} You can extend the behavior of parse-form by implementing parse-formt of FormParsable protocol. For example, (extend-protocol clucie.query/FormParsable java.util.regex.Pattern (parse-formt [re {:keys [key]}] (org.apache.lucene.search.RegexpQuery. (org.apache.lucene.index.Term. (stringify-value key) (.pattern re))))) adds a new rule that builds an org.apache.lucene.search.RegexpQuery from a regexp.
(postwalk f query)
Performs a depth-first, post-order traversal of query. Calls f on each sub-query, uses f's return value in place of the original.
Performs a depth-first, post-order traversal of query. Calls f on each sub-query, uses f's return value in place of the original.
(postwalk-demo query)
Demonstrates the behavior of postwalk by printing each query as it is walked. Returns query.
Demonstrates the behavior of postwalk by printing each query as it is walked. Returns query.
(prewalk f query)
Like postwalk, but does pre-order traversal.
Like postwalk, but does pre-order traversal.
(prewalk-demo query)
Demonstrates the behavior of prewalk by printing each query as it is walked. Returns query.
Demonstrates the behavior of prewalk by printing each query as it is walked. Returns query.
(walk inner outer query)
Traverses query. inner and outer are functions. Applies inner to each sub-query of query, building up a query of the same type, then applies outer to the result.
Traverses query. inner and outer are functions. Applies inner to each sub-query of query, building up a query of the same type, then applies outer to the result.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close