{"id":13609881,"url":"https://github.com/haroldadmin/lucilla","last_synced_at":"2025-03-16T19:31:16.213Z","repository":{"id":43734564,"uuid":"451188775","full_name":"haroldadmin/lucilla","owner":"haroldadmin","description":"Fast, efficient, in-memory Full Text Search for Kotlin","archived":false,"fork":false,"pushed_at":"2022-02-21T04:25:30.000Z","size":5497,"stargazers_count":131,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-27T12:24:35.172Z","etag":null,"topics":["full-text-search","kotlin","tf-idf","trie"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haroldadmin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-23T18:06:44.000Z","updated_at":"2025-02-11T19:09:53.000Z","dependencies_parsed_at":"2022-09-16T17:11:59.008Z","dependency_job_id":null,"html_url":"https://github.com/haroldadmin/lucilla","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haroldadmin%2Flucilla","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haroldadmin%2Flucilla/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haroldadmin%2Flucilla/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haroldadmin%2Flucilla/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haroldadmin","download_url":"https://codeload.github.com/haroldadmin/lucilla/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826780,"owners_count":20354220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["full-text-search","kotlin","tf-idf","trie"],"created_at":"2024-08-01T19:01:38.912Z","updated_at":"2025-03-16T19:31:14.882Z","avatar_url":"https://github.com/haroldadmin.png","language":"Kotlin","funding_links":[],"categories":["Kotlin","数据库"],"sub_categories":["Spring Cloud框架"],"readme":"# Lucilla\n\n[![Build](https://github.com/haroldadmin/lucilla/actions/workflows/build.yaml/badge.svg)](https://github.com/haroldadmin/lucilla/actions/workflows/build.yaml)\n[![Jitpack](https://jitpack.io/v/haroldadmin/lucilla.svg)](https://jitpack.io/#haroldadmin/lucilla)\n\nLucilla is an in-memory Full Text Search library for Kotlin.\n\nIt allows to you to build a Full Text Search index for data that does not need to be persisted to a database.\nYou can run search queries against the index to find matching documents quickly.\n\n```kotlin\nimport com.haroldadmin.lucilla.core.*\n\ndata class Book(\n    @Id\n    val id: Int,\n    val title: String,\n    val summary: String,\n)\n\nval index = useFts(getBooks())\n\nindex.search(\"Martian\").map { searchResult -\u003e\n    val bookId = searchResult.documentId\n    val book = getBook(bookId)\n    // Show search result to the user\n}\n```\n\n\u003e Lucilla is in active development. It's an early stage prototype, and not suitable for production use yet.\n\n## Features\n\n- PATRICIA Trie based space efficient FTS index\n- Advanced text processing pipeline with support for Tokenization, Stemming, Punctuation removal and more.\n- Extensible text processing with custom pipeline steps\n- Search results ranking using [TF-IDF](https://en.wikipedia.org/wiki/Tf%E2%80%93idf) scores \n- Customisable document parsing with ability to ignore unwanted fields\n\nWhile lucilla has you covered on most of the basic features, support for some advanced features is missing (but planned):\n- Fuzzy searching\n- Custom field boosts\n- Async processing\n\n## Usage\n\n### Modelling Data\n\nTo use lucilla's FTS capabilities, you must first model your data as a class. \n\nWe recommend using data classes for this purpose, but anything should work as long as it satisfies the following requirements:\n- Must have a `@Id` marked field that can be parsed as an `Int`\n- Must have one or more other properties that can be parsed as `String`s\n\n```kotlin\nimport com.haroldadmin.lucilla.core.Id\n\ndata class Book(\n  @Id\n  val id: Int,\n  val title: String,\n  val summary: String,\n)\n```\n\nIf you don't want lucilla to index some fields of your document, annotate them with `@Ignore`.\n\n```kotlin\nimport com.haroldadmin.lucilla.core.Id\nimport com.haroldadmin.lucilla.core.Ignore\n\ndata class Book(\n    @Id\n    val id: Int,\n    val title: String,\n    val summary: String, \n    @Ignore\n    val publisher: String,\n)\n```\n\n### Create the Index\n\nCreate an FTS index and add your data to it:\n\n```kotlin\nval index = useFts\u003cBook\u003e()\ngetBooks().forEach { index.add(it) }\n\n// You can also pass your seed data directly\nval books = getBooks()\nval index = useFts\u003cBook\u003e(books)\n```\n\nAdding documents to the index, or creating the index with seed data is a potentially expensive process depending on how large each document is.\nIt's best to perform this process on a background thread or Coroutine.\n\n### Search the Index\n\nSend your queries to the index to get search results ordered by relevance.\n\n```kotlin\nval searchResults = index.search(query)\nval books = searchResults.map { r -\u003e r.documentId }.map { id -\u003e getBook(id) }\nshowResults(books)\n```\n\nLucilla runs every search query through a text processing pipeline to extract searchable tokens from it. The tokens may not reflect the search query exactly. \nTo find which token of your search query matched with a given search result, use the \"matchTerm\" property on a search result.\n\n## Installation\n\nAdd the Jitpack repository to your list of repositories:\n\n```groovy\n// Project level build.gradle file\nallprojects {\n    repositories {\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\n\nAnd then add the dependency in your gradle file:\n\n```groovy\n// Module build.gradle file\ndependencies {\n    implementation \"com.github.haroldadmin.lucilla:core:(latest-version)\"\n}\n```\n\n[![Jitpack](https://jitpack.io/v/haroldadmin/lucilla.svg)](https://jitpack.io/#haroldadmin/lucilla)\n\n## Contributing\n\nlucilla is in active development and does not promise API stability. Expect the library to undergo significant changes before it reaches stable status.\n\nWe encourage the community to contribute features and report bugs.\n\n## Meta\n\nThe name 'lucilla' is inspired from the name of [Sebastian Vettel's 2020 Ferrari](https://www.espn.in/f1/story/_/id/28890092/vettel-names-2020-car-lucilla).\nIt also sounds similar to _lucene_ (from Apache Lucene), which is the industry standard full text search framework.\n\nlucilla's implementation borrows from a JavaScript library [MiniSearch](https://github.com/lucaong/minisearch).\n\n## License\n\n```text\nMIT License\n\nCopyright (c) 2022 Kshitij Chauhan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharoldadmin%2Flucilla","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharoldadmin%2Flucilla","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharoldadmin%2Flucilla/lists"}