Clucy is a Clojure interface to Lucene.
To use Clucy, first require it:
(ns example
(:require [clucy.core :as clucy]))
Then create an index. You can use (memory-index)
, which stores the search
index in RAM, or (disk-index "/path/to/a-folder")
, which stores the index in
a folder on disk.
(def index (clucy/memory-index))
Next, add Clojure maps to the index:
(clucy/add index
{:name "Bob", :job "Builder"}
{:name "Donald", :job "Computer Scientist"})
Once maps have been added, the index can be searched:
user=> (clucy/search index "bob" 10)
({:name "Bob", :job "Builder"})
user=> (clucy/search index "scientist" 10)
({:name "Donald", :job "Computer Scientist"})