+
Apache Lucene Core
+
Apache LuceneTM is a
+ high-performance, full-featured text search engine library written entirely in Java.
+ It is a technology suitable for nearly any application that requires full-text search,
+ especially cross-platform.
+
Apache Lucene is an open source project available for free download. Please use the
+ links on the right to access Lucene.
+
LuceneTM Features
+
Lucene offers powerful features through a simple API:
+
+
+ - over 150GB/hour on modern hardware
+ - small RAM requirements -- only 1MB heap
+ - incremental indexing as fast as batch indexing
+ - index size roughly 20-30% the size of text indexed
+
+ """.trimIndent()
+
+ index("first", content = content)
+
+ assertThat(search(content = "fast"))
+ .hasSize(1)
+ .anyMatch { it.title == "first" }
+
+ @Suppress("SpellCheckingInspection")
+ assertThat(search(content = "preformance")) // <- note the error
+ .hasSize(1)
+ .anyMatch { it.title == "first" }
+ }
+
+ @Test
+ fun `combined search`() {
+ @Language("html")
+ val content =
+ """
+
+
Apache Lucene Core
+
Apache LuceneTM is a
+ high-performance, full-featured text search engine library written entirely in Java.
+ It is a technology suitable for nearly any application that requires full-text search,
+ especially cross-platform.
+
Apache Lucene is an open source project available for free download. Please use the
+ links on the right to access Lucene.
+
LuceneTM Features
+
Lucene offers powerful features through a simple API:
+
+
+ - over 150GB/hour on modern hardware
+ - small RAM requirements -- only 1MB heap
+ - incremental indexing as fast as batch indexing
+ - index size roughly 20-30% the size of text indexed
+
+ """.trimIndent()
+
+ index("first", content = content, tags = listOf("abc"))
+
+ assertThat(search(title = "fir", tag = "abc", content = "20"))
+ .hasSize(1)
+ }
+
+ @Test
+ fun `delete index`() {
+ val uuid = index("first").uuid
+ searcher.deleteIndex(1, uuid)
+ assertThat(search("first")).isEmpty()
+ }
+
+ @Test
+ fun `update index`() {
+ val note = index("first")
+ searcher.updateIndex(1, note.copy(meta = note.meta.copy(title = "new")))
+ assertThat(search("first")).isEmpty()
+ assertThat(search("new")).hasSize(1)
+ }
+}