Liking cljdoc? Tell your friends :D

memsearch.text.search


default-fetch-fncljs

(default-fetch-fn db doc-ids)

The db is expected to be a map with doc-ids as keys and maps as values. Each value map may contain the data that needs to come out of the db.

The db is expected to be a map with doc-ids as keys and maps as values.
Each value map may contain the data that needs to come out of the db.
sourceraw docstring

fetch-docs-for-a-wordcljs

(fetch-docs-for-a-word w index)

Fetches all the indexed docs for a word.

Fetches all the indexed docs for a word.
sourceraw docstring

highest-similaritycljs

(highest-similarity w str-set)

Returns the similarilty value (between 0 and 1, both inclusive) for a word against the best similar word from a set of words.

Returns the similarilty value (between 0 and 1, both inclusive) for a word 
against the best similar word from a set of words.
sourceraw docstring

merge-scored-docscljs

(merge-scored-docs m1 m2)

Example inputs: {1 {:score 10 :data {:age 20}}} and {1 {:score 12 :data {:age 20}} 2 {:score 5 :data {:age 30}}} Return: {1 {:score 22 :data {:age 20}} 2 {:score 5 :data {:age 30}}} If there are duplicate keys (values are equal):

  • The values of :score gets added.
  • The values of :data are expected to be equal in both the inputs, and will be returned as is. If the keys are not duplicate, then simply append as a key val pair.
Example inputs: {1 {:score 10 :data {:age 20}}} and {1 {:score 12 :data {:age 20}} 2 {:score 5 :data {:age 30}}}
Return: {1 {:score 22 :data {:age 20}} 2 {:score 5 :data {:age 30}}}
If there are duplicate keys (values are equal):
 - The values of :score gets added.
 - The values of :data are expected to be equal in both the inputs, and will be returned as is.
If the keys are not duplicate, then simply append as a key val pair.
sourceraw docstring

score-comparatorcljs

(score-comparator m & increasing?)

Sorting comparator based on the score, either in increasing or in decreasing order. Defaults to decreasing order.

Sorting comparator based on the score, either in increasing or in decreasing order.
Defaults to decreasing order.
sourceraw docstring

scored-doc-for-a-wordcljs

(scored-doc-for-a-word w doc)

Returns a map with doc-id as key and a map (with :score) as value. The supplied doc is expected to have :id and :frequency of the supplied word.

Returns a map with doc-id as key and a map (with :score) as value.
The supplied doc is expected to have :id and :frequency of the supplied word.
sourceraw docstring

scored-docscljs

(scored-docs s-coll index & opts-map)

Results from the index map based on the supplied words collection. Return value may or may not be sorted based on provided options. Defaults to non-sorted result.

Results from the index map based on the supplied words collection.
Return value may or may not be sorted based on provided options.
Defaults to non-sorted result.
sourceraw docstring

scored-docs-for-str-collcljs

(scored-docs-for-str-coll s-coll index)

Fetches the docs for all the valid words of the supplied collection. The score for each fetched doc is combined (added) for each word of the words collection, to compute the final socre for the doc.

Fetches the docs for all the valid words of the supplied collection.
The score for each fetched doc is combined (added) for each word of the words collection, 
to compute the final socre for the doc.
sourceraw docstring

scored-docs-for-wordcljs

(scored-docs-for-word w docs)

Returns a map with doc-ids as keys and a maps (with :score) as values. The supplied docs are expected to have :id and :frequency of the supplied word.

Returns a map with doc-ids as keys and a maps (with :score) as values.
The supplied docs are expected to have :id and :frequency of the supplied word.
sourceraw docstring

scored-docs-with-datacljs

(scored-docs-with-data s-coll index db & opts-map)

If a custom fetch fn is not provided in the opts-map, then the db is expected to be a map with doc-ids as keys and maps as values. The return value of fetch-fn is expected to be a map or a coll similar to: {1 {:data {}} 2 {:data {}}} or [{1 {:data {}}} {2 {:data {}}}]

If a custom fetch fn is not provided in the opts-map, then the db is expected to be a map with doc-ids as keys and maps as values.
The return value of fetch-fn is expected to be a map or a coll similar to:
{1 {:data {}} 2 {:data {}}} or [{1 {:data {}}} {2 {:data {}}}]
sourceraw docstring

sorted-scored-docscljs

(sorted-scored-docs s-coll index & increasing?)

Results sorted by score, either in increasing or in decreasing order. Defaults to decreasing order.

Results sorted by score, either in increasing or in decreasing order.
Defaults to decreasing order.
sourceraw docstring

(text-search query-string index & opts-map)

Search the index with a string of one or more words. Various options can be provided: :db - If provided, the return value will contain additional data from the db based on the doc-ids returned by the index. :fetch-fn - A function with args signature [db doc-ids]. Exists only with :db key. It is expected to return results in the form similar to {1 {:data {}} 2 {:data {}}} or [{1 {:data {}}} {2 {:data {}}}]. The key :dataand its value could be any key and value. :sorted? - If true, the result should be sorted. Defaults to decreasing order of sorting. :increasing? - Exists only with :sorted? key, a true value indicates the sorting to be in the increasing order. :valid-word-fn - A single arity fn that takes one word (string) and returns boolean.

Search the index with a string of one or more words.
Various options can be provided:
 :db - If provided, the return value will contain additional data from the db based on the doc-ids returned by the index.
 :fetch-fn - A function with args signature `[db doc-ids]`. Exists only with :db key.
             It is expected to return results in the form similar to {1 {:data {}} 2 {:data {}}} or [{1 {:data {}}} {2 {:data {}}}].
             The key `:data `and its value could be any key and value.
 :sorted? - If `true`, the result should be sorted. Defaults to decreasing order of sorting.
 :increasing? - Exists only with :sorted? key, a `true` value indicates the sorting to be in the increasing order.
 :valid-word-fn - A single arity fn that takes one word (string) and returns boolean.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close