The lucene module defines high level functions on top of Lucene API.
openLuceneIndex() returns a handle to read/write a Lucene index.
lc = openLuceneIndex("index")
add() registers an index of the specified elements, which can be either of the following type.
When locale is omiited, the value of getLocale() would be implicitly used.
lc.add("doc/test.txt", Locale::ENGLISH)
delete() deletes an index entry that the query matches the attribute.
lc.delete("path", "doc/test.txt")
search() searches documents that the query matches the attribute.
for (i : lc.search("contents", "keyword")){
println(i)
}
If handler is given, the handler is called passing the matched documents.
lc.search("contents", "keyword", function (doc) println(doc.get("path")))
If handler is not given, getDocument() returns an object that generates all existing documents in the Lucene Index.
for (i : lc.getDocuments()){
println(i)
}
If handler is specified, getDocuments() calls the handler passing the documents in the Lucene index.
lc.getDocuments(function (doc) println(doc.get("path")))