(quick-score string query)
(quick-score string query config)
Given a string a query (and optional config), returns a score between 0.0 and 1.0, where 1.0 is the highest (often an exact match), and 0.0 is a non-match. Whether or not a query matches (and what counts as a match) will depend on the :searcher, while the score will depend on the :scorer. Both of these can be set in the config.
The default :searcher is a linear fuzzy searcher: characters from the query must appear in order in the string to count as a match.
The default :scorer is ballpark.standard/scorer
Given a string a query (and optional config), returns a score between 0.0 and 1.0, where 1.0 is the highest (often an exact match), and 0.0 is a non-match. Whether or not a query matches (and what counts as a match) will depend on the :searcher, while the score will depend on the :scorer. Both of these can be set in the config. The default :searcher is a linear fuzzy searcher: characters from the query must appear in order in the string to count as a match. The default :scorer is ballpark.standard/scorer
(quick-score-collection coll query)
(quick-score-collection coll keyseq query)
(quick-score-collection coll keyseq query config)
Given a collection of maps and query, return a sorted collection,
where the highest-scoring items are first. Each map in the return
has the original nested under :item
, and other keys are set as by
quick-score-keys
.
By default, all keys with detected string values will be scored, but
this can be changed by providing a keyseq
.
An optional config can be supplied, but defaults to base-config
.
Given a collection of maps and query, return a sorted collection, where the highest-scoring items are first. Each map in the return has the original nested under `:item`, and other keys are set as by `quick-score-keys`. By default, all keys with detected string values will be scored, but this can be changed by providing a `keyseq`. An optional config can be supplied, but defaults to `base-config`.
(quick-score-keys m keyseq query config)
Given a map m
, keys to search (keyseq
), a query, and config,
returns a new scored map, with the original map nested under
:item
. For each key in the keyseq
, values are retrieved from the
map with get
.
In the return value map, the following keys:
:item The original map (m)
:matches A map of key => match ranges, for each of
the given keys in the keyseq
:scores A map of key => score, for each of the
given keys in the keyseq
:score The highest score from the scores key
:key The key that yielded the highest score
When query
is empty, returns a map with just the :item
key, and
no score or match keys.
Given a map `m`, keys to search (`keyseq`), a query, and config, returns a new scored map, with the original map nested under `:item`. For each key in the `keyseq`, values are retrieved from the map with `get`. In the return value map, the following keys: :item The original map (m) :matches A map of key => match ranges, for each of the given keys in the keyseq :scores A map of key => score, for each of the given keys in the keyseq :score The highest score from the scores key :key The key that yielded the highest score When `query` is empty, returns a map with just the `:item` key, and no score or match keys.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close