{"id":18015593,"url":"https://github.com/nomemory/jasuggest","last_synced_at":"2025-06-21T12:39:55.596Z","repository":{"id":82269818,"uuid":"95867009","full_name":"nomemory/jasuggest","owner":"nomemory","description":"A simple autosuggest library based on a Java Trie implementation. ","archived":false,"fork":false,"pushed_at":"2017-07-12T13:53:02.000Z","size":428,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-04T02:45:47.356Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nomemory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-30T08:28:02.000Z","updated_at":"2025-01-10T05:47:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"b87b0e53-87dd-4e0d-add7-11b100c9d576","html_url":"https://github.com/nomemory/jasuggest","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nomemory/jasuggest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fjasuggest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fjasuggest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fjasuggest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fjasuggest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nomemory","download_url":"https://codeload.github.com/nomemory/jasuggest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fjasuggest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261126212,"owners_count":23113290,"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":[],"created_at":"2024-10-30T04:14:28.958Z","updated_at":"2025-06-21T12:39:50.579Z","avatar_url":"https://github.com/nomemory.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## jasuggest\n\nA simple autosuggest library based on a [Trie](https://en.wikipedia.org/wiki/Trie) implementation. \n\nAvailable in [jcenter()](https://bintray.com/nomemory/maven/jasuggest).\n\n**Maven**\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003enet.andreinc.jasuggest\u003c/groupId\u003e\n  \u003cartifactId\u003ejasuggest\u003c/artifactId\u003e\n  \u003cversion\u003e0.0.1\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n**Gradle**\n```\ncompile 'net.andreinc.jasuggest:jasuggest:0.0.1'\n```\n\n## Simple Example\n\n```java\n\nString[] words = { \"us\", \"usa\", \"use\", \"useful\", \"useless\", \"user\", \"usurper\" };\n\n// All the searches will be cached in a ConcurrentHashMap with a maximum size of 512 elements.\n// Check: https://github.com/jhalterman/expiringmap\nJaCacheConfig jaCacheConfig =\n                JaCacheConfig.builder()\n                             .maxSize(512)\n                             .build();\n\nJaSuggest jaSuggest = JaSuggest.builder()\n                               .ignoreCase()\n                               .withCache(jaCacheConfig)\n                               .buildFrom(words);\n                               \nList\u003cString\u003e result = jaSuggest.findSuggestions(\"use\");\n\n// [useful, useless, user]\n```        \n\nThe above example creates internally creates a Trie based on the supplied `words`. In memory the Trie looks like:\n\n![Image of the trie](https://github.com/nomemory/jasuggest/blob/master/media/Diagram.png)\n\n**Notes:** \n\n* Each blue node has an additional property that marks the existence of an word. So when the `findSuggestions()` method is called a tree traversal is performed in order to determine all the possible outcomes. When a \"blue node\" is visited the result is added to the map and the traversing operation continues;\n\n* The library supports caching the results. \n\n## Simple Example - Increasing performance at the cost of memory consumption\n\nThe builder() method `prebuiltWords()` adds more information to the Trie. Basically each \"blue node\" that marks the existence of a word also contains the same word as a property:\n\n![Image of the trie](https://github.com/nomemory/jasuggest/blob/master/media/Diagram2.png)\n\nSo the only change you need to make is when you create the `JaSuggest` object:\n\n```java\nJaSuggest jaSuggest = JaSuggest.builder()\n                               .ignoreCase()\n                               .prebuiltWords() // !HERE!\n                               .withCache(jaCacheConfig)\n                               .buildFrom(words);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomemory%2Fjasuggest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnomemory%2Fjasuggest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomemory%2Fjasuggest/lists"}