{"id":22494514,"url":"https://github.com/SeekStorm/SeekStorm","last_synced_at":"2025-08-03T01:32:59.700Z","repository":{"id":224757529,"uuid":"764081389","full_name":"SeekStorm/SeekStorm","owner":"SeekStorm","description":"SeekStorm - sub-millisecond full-text search library \u0026 multi-tenancy server in Rust","archived":false,"fork":false,"pushed_at":"2024-10-24T17:04:08.000Z","size":4042,"stargazers_count":167,"open_issues_count":1,"forks_count":12,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-25T15:41:40.981Z","etag":null,"topics":["apache2","bm25","enterprise-search","faceting","full-text-search","geosearch","index","lexical-search","okapi-bm25","query","realtime","rust","saas","search","search-engine","search-server","search-service","sparse-retrieval"],"latest_commit_sha":null,"homepage":"https://seekstorm.com","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SeekStorm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2024-02-27T12:55:08.000Z","updated_at":"2024-10-25T12:42:33.000Z","dependencies_parsed_at":"2024-03-16T14:52:45.454Z","dependency_job_id":"d204c512-6976-476b-8411-784e33ea120e","html_url":"https://github.com/SeekStorm/SeekStorm","commit_stats":null,"previous_names":["seekstorm/seekstorm"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeekStorm%2FSeekStorm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeekStorm%2FSeekStorm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeekStorm%2FSeekStorm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeekStorm%2FSeekStorm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SeekStorm","download_url":"https://codeload.github.com/SeekStorm/SeekStorm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228516090,"owners_count":17932446,"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":["apache2","bm25","enterprise-search","faceting","full-text-search","geosearch","index","lexical-search","okapi-bm25","query","realtime","rust","saas","search","search-engine","search-server","search-service","sparse-retrieval"],"created_at":"2024-12-06T19:02:50.950Z","updated_at":"2025-08-03T01:32:59.686Z","avatar_url":"https://github.com/SeekStorm.png","language":"Rust","funding_links":[],"categories":["*Ops for AI","Rust","Libraries"],"sub_categories":["Model Serving \u0026 Inference","Text search"],"readme":"\n\u003cimg src=\"assets/logo.png\" width=\"450\" alt=\"Logo\"\u003e\u003cbr\u003e\n[![Crates.io](https://img.shields.io/crates/v/seekstorm.svg)](https://crates.io/crates/seekstorm)\n[![Downloads](https://img.shields.io/crates/d/seekstorm.svg?style=flat-square)](https://crates.io/crates/seekstorm)\n[![Documentation](https://docs.rs/seekstorm/badge.svg)](https://docs.rs/seekstorm)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/SeekStorm/SeekStorm?tab=Apache-2.0-1-ov-file#readme)\n[![Docker](https://img.shields.io/docker/pulls/wolfgarbe/seekstorm_server)](https://hub.docker.com/r/wolfgarbe/seekstorm_server)\n\u003cp\u003e\n  \u003ca href=\"https://seekstorm.com\"\u003eWebsite\u003c/a\u003e | \n  \u003ca href=\"https://seekstorm.github.io/search-benchmark-game/\"\u003eBenchmark\u003c/a\u003e | \n  \u003ca href=\"https://deephn.org/\"\u003eDemo\u003c/a\u003e | \n  \u003ca href=\"#documentation\"\u003eLibrary Docs\u003c/a\u003e | \n  \u003ca href=\"https://seekstorm.apidocumentation.com\"\u003eServer Docs\u003c/a\u003e |\n  \u003ca href=\"https://github.com/SeekStorm/SeekStorm/blob/main/src/seekstorm_server/README.md\"\u003eServer Readme\u003c/a\u003e |\n  \u003ca href=\"#roadmap\"\u003eRoadmap\u003c/a\u003e | \n  \u003ca href=\"https://seekstorm.com/blog/\"\u003eBlog\u003c/a\u003e | \n  \u003ca href=\"https://x.com/seekstorm\"\u003eTwitter\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n**SeekStorm** is an **open-source, sub-millisecond full-text search library** \u0026 **multi-tenancy server** implemented in **Rust**.\n\nDevelopment started in 2015, in [production](https://seekstorm.com) since 2020, Rust port in 2023, open sourced in 2024, work in progress.\n\nSeekStorm is open source licensed under the [Apache License 2.0](https://github.com/SeekStorm/SeekStorm?tab=Apache-2.0-1-ov-file#readme)\n\nBlog Posts: [SeekStorm is now Open Source](https://seekstorm.com/blog/sneak-peek-seekstorm-rust/) and [SeekStorm gets Faceted search, Geo proximity search, Result sorting](https://seekstorm.com/blog/faceted_search-geo-proximity-search/)\n\n### SeekStorm high-performance search library\n\n* Full-text lexical search\n* True real-time search, with negligible performance impact\n* Incremental indexing\n* Multithreaded indexing \u0026 search\n* Unlimited field number, field length \u0026 index size\n* Compressed document store: ZStandard\n* Boolean queries: AND, OR, PHRASE, NOT\n* BM25F and BM25F_Proximity ranking\n* Field filtering\n* [Faceted search](https://github.com/SeekStorm/SeekStorm/blob/main/FACETED_SEARCH.md): Counting \u0026 filtering of String \u0026 Numeric range facets (with Histogram/Bucket \u0026 Min/Max aggregation)\n* Result sorting by any field, ascending or descending, multiple fields combined by \"tie-breaking\". \n* Geo proximity search, filtering and sorting.\n* 6 tokenizers, including Chinese word segmentation.\n* Stemming for 18 languages\n* Stopword lists, custom and predefined, for smaller indices and faster search.\n* Frequent word lists, custom and predefined, for faster phrase search by n-gram indexing.\n* KWIC snippets, highlighting\n* One-way and multi-way synonyms\n* Billion-scale index\n* Language independent\n* API keys\n* RESTful API with CORS\n* Index either in RAM or memory mapped files\n* Cross-platform (Windows, Linux, MacOS)\n* SIMD (Single Instruction, Multiple Data) hardware acceleration support,  \n  both for x86-64 (AMD64 and Intel 64) and AArch64 (ARM, Apple Silicon).\n* Single-machine scalability: serving thousands of concurrent queries with low latency from a single commodity server without needing clusters or proprietary hardware accelerators.\n\nQuery types\n+ OR  disjunction  union\n+ AND conjunction intersection\n+ \"\"  phrase\n+ \\-   NOT\n\nResult types\n+ TopK\n+ Count\n+ TopKCount\n\n### SeekStorm multi-tenancy search server \n\n  * Index and search via [RESTful API](https://github.com/SeekStorm/SeekStorm/blob/main/src/seekstorm_server#rest-api-endpoints).\n  * Ingest local data files in [CSV](https://en.wikipedia.org/wiki/Comma-separated_values), [JSON](https://en.wikipedia.org/wiki/JSON), [Newline-delimited JSON](https://github.com/ndjson/ndjson-spec) (ndjson), and [Concatenated JSON](https://en.wikipedia.org/wiki/JSON_streaming) formats via console command.  \n  * Ingest local PDF files via console command (single file or all files in a directory).\n  * Multi-tenancy index management.\n  * API-key management.\n  * [Embedded web server and web UI](https://github.com/SeekStorm/SeekStorm/blob/main/src/seekstorm_server#open-embedded-web-ui-in-browser) to search and display results from any index without coding.\n  * Code first OpenAPI generated [REST API documentation](https://seekstorm.apidocumentation.com)\n  * Cross-platform: runs on Linux, Windows, and macOS (other OS untested).\n  * Docker file and container image at [Docker Hub](https://hub.docker.com/r/wolfgarbe/seekstorm_server)\n\n---\n\n## Why SeekStorm?\n\n**Performance**  \nLower latency, higher throughput, lower cost \u0026 energy consumption, esp. for multi-field and concurrent queries.  \nLow tail latencies ensure a smooth user experience and prevent loss of customers and revenue.  \nWhile some rely on proprietary hardware accelerators (FPGA/ASIC) or clusters to improve performance,  \nSeekStorm achieves a similar boost algorithmically on a single commodity server.\n\n**Consistency**  \nNo unpredictable query latency during and after large-volume indexing as SeekStorm doesn't require resource-intensive segment merges.  \nStable latencies - no cold start costs due to just-in-time compilation, no unpredictable garbage collection delays.  \n\n**Scaling**  \nMaintains low latency, high throughput, and low RAM consumption even for billion-scale indices.  \nUnlimited field number, field length \u0026 index size.\n\n**Relevance**  \nTerm proximity ranking provides more relevant results compared to BM25.\n\n**Real-time**  \nTrue real-time search, as opposed to NRT: every indexed document is immediately searchable, even before and during commit.\n\n## Benchmarks\n\n\u003cimg src=\"assets/search_benchmark_game1.png\" width=\"800\" alt=\"Benchmark\"\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cimg src=\"assets/search_benchmark_game2.png\" width=\"800\" alt=\"Benchmark\"\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cimg src=\"assets/ranking.jpg\" width=\"800\" alt=\"Ranking\"\u003e\n\n*the who: vanilla BM25 ranking vs. SeekStorm proximity ranking*\u003cbr\u003e\u003cbr\u003e\n\n**Methodology**  \nComparing different open-source search engine libraries (BM25 lexical search) using the open-source **search_benchmark_game** developed by [Tantivy](https://github.com/quickwit-oss/search-benchmark-game/) and [Jason Wolfe](https://github.com/jason-wolfe/search-index-benchmark-game).\n\n**Benefits**\n+ using a proven open-source benchmark used by other search libraries for comparability\n+ adapters written mostly by search library authors themselves for maximum authenticity and faithfulness\n+ results can be replicated by everybody on their own infrastructure\n+ detailed results per query, per query type and per result type to investigate optimization potential\n\n**Detailed benchmark results**\nhttps://seekstorm.github.io/search-benchmark-game/\n\n**Benchmark code repository**\nhttps://github.com/SeekStorm/search-benchmark-game/\n\nSee our **blog posts** for more detailed information: [SeekStorm is now Open Source](https://seekstorm.com/blog/sneak-peek-seekstorm-rust/) and [SeekStorm gets Faceted search, Geo proximity search, Result sorting](https://seekstorm.com/blog/faceted_search-geo-proximity-search/)\n\n### Why latency matters\n\n* Search speed might be good enough for a single search. Below 10 ms people can't tell latency anymore. Search latency might be small compared to internet network latency.\n* But search engine performance still matters when used in a server or service for many concurrent users and requests for maximum scaling, throughput, low processor load, and cost.\n* With performant search technology, you can serve many concurrent users at low latency with fewer servers, less cost, less energy consumption, and a lower carbon footprint.\n* It also ensures low latency even for complex and challenging queries: instant search, fuzzy search, faceted search, and union/intersection/phrase of very frequent terms.\n* Local search performance matters, e.g. when many local queries are spawned for reranking, fallback/refinement queries, fuzzy search, data mining or RAG befor the response is transferred back over the network.\n* Besides average latencies, we also need to reduce tail latencies, which are often overlooked but can cause loss of customers, revenue, and a bad user experience.\n* It is always advisable to engineer your search infrastructure with enough performance headroom to keep those tail latencies in check, even during periods of high concurrent load.\n* Also, even if a human user might not notice the latency, it still might make a big difference in autonomous stock markets, defense applications or RAG which requires multiple queries.\n\n---\n\n## Keyword search remains a core building block in the advent of vector search and LLMs\n\nDespite what the hype-cycles https://www.bitecode.dev/p/hype-cycles want you to believe, keyword search is not dead, as NoSQL wasn't the death of SQL.\n\nYou should maintain a toolbox, and choose the best tool for your task at hand. https://seekstorm.com/blog/vector-search-vs-keyword-search1/\n\nKeyword search is just a filter for a set of documents, returning those where certain keywords occur in, usually combined with a ranking metric like BM25.\nA very basic and core functionality is very challenging to implement at scale with low latency.\nBecause the functionality is so basic, there is an unlimited number of application fields.\nIt is a component, to be used together with other components.\nThere are use cases which can be solved better today with vector search and LLMs, but for many more keyword search is still the best solution.\nKeyword search is exact, lossless, and it is very fast, with better scaling, better latency, lower cost and energy consumption.\nVector search works with semantic similarity, returning results within a given proximity and probability. \n\n### Keyword search (lexical search)\nIf you search for exact results like proper names, numbers, license plates, domain names, and phrases (e.g. plagiarism detection) then keyword search is your friend. Vector search, on the other hand, will bury the exact result that you are looking for among a myriad of results that are only somehow semantically related. At the same time, if you don’t know the exact terms, or you are interested in a broader topic, meaning or synonym, no matter what exact terms are used, then keyword search will fail you.\n\n```diff\n- works with text data only\n- unable to capture context, meaning and semantic similarity\n- low recall for semantic meaning\n+ perfect recall for exact keyword match \n+ perfect precision (for exact keyword match)\n+ high query speed and throughput (for large document numbers)\n+ high indexing speed (for large document numbers)\n+ incremental indexing fully supported\n+ smaller index size\n+ lower infrastructure cost per document and per query, lower energy consumption\n+ good scalability (for large document numbers)\n+ perfect for exact keyword and phrase search, no false positives\n+ perfect explainability\n+ efficient and lossless for exact keyword and phrase search\n+ works with new vocabulary out of the box\n+ works with any language out of the box\n+ works perfect with long-tail vocabulary out of the box\n+ works perfect with any rare language or domain-specific vocabulary out of the box\n+ RAG (Retrieval-augmented generation) based on keyword search offers unrestricted real-time capabilities.\n```\n\n\n### Vector search\nVector search is perfect if you don’t know the exact query terms, or you are interested in a broader topic, meaning or synonym, no matter what exact query terms are used. But if you are looking for exact terms, e.g. proper names, numbers, license plates, domain names, and phrases (e.g. plagiarism detection) then you should always use keyword search. Vector search will instead bury the exact result that you are looking for among a myriad of results that are only somehow related. It has a good recall, but low precision, and higher latency. It is prone to false positives, e.g., in plagiarism detection as exact words and word order get lost.\n\nVector search enables you to search not only for similar text, but for everything that can be transformed into a vector: text, images (face recognition, fingerprints), audio, enabling you to do magic things like \"queen - woman + man = king.\"\n\n```diff\n+ works with any data that can be transformed to a vector: text, image, audio ...\n+ able to capture context, meaning, and semantic similarity\n+ high recall for semantic meaning (90%)\n- lower recall for exact keyword match (for Approximate Similarity Search)\n- lower precision (for exact keyword match)\n- lower query speed and throughput (for large document numbers)\n- lower indexing speed (for large document numbers)\n- incremental indexing is expensive and requires rebuilding the entire index periodically, which is extremely time-consuming and resource intensive.\n- larger index size\n- higher infrastructure cost per document and per query, higher energy consumption\n- limited scalability (for large document numbers)\n- unsuitable for exact keyword and phrase search, many false positives\n- low explainability makes it difficult to spot manipulations, bias and root cause of retrieval/ranking problems\n- inefficient and lossy for exact keyword and phrase search\n- Additional effort and cost to create embeddings and keep them updated for every language and domain. Even if the number of indexed documents is small, the embeddings have to created from a large corpus before nevertheless.\n- Limited real-time capability due to limited recency of embeddings\n- works only with vocabulary known at the time of embedding creation\n- works only with the languages of the corpus from which the embeddings have been derived\n- works only with long-tail vocabulary that was sufficiently represented in the corpus from which the embeddings have been derived\n- works only with rare language or domain-specific vocabulary that was sufficiently represented in the corpus from which the embeddings have been derived\n- RAG (Retrieval-augmented generation) based on vector search offers only limited real-time capabilities, as it can't process new vocabulary that arrived after the embedding generation\n```\n\n\u003cbr\u003e\n\n\u003e **Vector search is not a replacement for keyword search, but a complementary addition** - best to be used within a hybrid solution where the strengths of both approaches are combined. **Keyword search is not outdated, but time-proven**.\n\n---\n\n## Why Rust\n\nWe have (partially) ported the SeekStorm codebase from C# to Rust\n+ Factor 2..4x performance gain vs. C# (latency and throughput)\n+ No slow first run (no cold start costs due to just-in-time compilation)\n+ Stable latencies (no garbage collection delays)\n+ Less memory consumption (no ramping up until the next garbage collection)\n+ No framework dependencies (CLR or JVM virtual machines)\n+ Ahead-of-time instead of just-in-time compilation\n+ Memory safe language https://www.whitehouse.gov/oncd/briefing-room/2024/02/26/press-release-technical-report/ \n\nRust is great for performance-critical applications 🚀 that deal with big data and/or many concurrent users. \nFast algorithms will shine even more with a performance-conscious programming language 🙂\n\n---\n\n## Architecture\n\nsee [ARCHITECTURE.md](https://github.com/SeekStorm/SeekStorm/blob/main/ARCHITECTURE.md) \n\n---\n\n### Building\n\n```\ncargo build --release\n```\n\n\u0026#x26A0; **WARNING**: make sure to set the MASTER_KEY_SECRET environment variable to a secret, otherwise your generated API keys will be compromised.\n\n### Documentation\n\n[https://docs.rs/seekstorm](https://docs.rs/seekstorm)\n\n**Build documentation**\n\n```\ncargo doc --no-deps\n```\n\n**Access documentation locally**\n\nSeekStorm\\target\\doc\\seekstorm\\index.html  \nSeekStorm\\target\\doc\\seekstorm_server\\index.html  \n\n### Feature Flags\n\n- **`zh` (default)**: Enables TokenizerType.UnicodeAlphanumericZH that implements Chinese word segmentation to segment continuous Chinese text into tokens for indexing and search.\n- **`pdf` (default)**: Enables PDF ingestion via `pdfium` crate.\n\nYou can disable the SeekStorm default features by using default-features = false in the cargo.toml of your application.  \nThis can be useful to reduce the size of your application or if there are dependency version conflicts.\n```cargo\n[dependencies]\nseekstorm = { version = \"0.12.19\", default-features = false }\n```\n\n### Usage of the library\n\nAdd required crates to your project\n```rust\ncargo add seekstorm\ncargo add tokio\ncargo add serde_json\n```\n\n```rust\nuse std::{collections::HashSet, error::Error, path::Path, sync::Arc};\nuse seekstorm::{index::*,search::*,highlighter::*,commit::Commit};\nuse tokio::sync::RwLock;\n```\n\nuse an asynchronous Rust runtime\n```rust\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn Error + Send + Sync\u003e\u003e {\n```\n\ncreate schema (from JSON)\n```rust\nlet schema_json = r#\"\n[{\"field\":\"title\",\"field_type\":\"Text\",\"stored\":false,\"indexed\":false},\n{\"field\":\"body\",\"field_type\":\"Text\",\"stored\":true,\"indexed\":true},\n{\"field\":\"url\",\"field_type\":\"Text\",\"stored\":false,\"indexed\":false}]\"#;\nlet schema=serde_json::from_str(schema_json).unwrap();\n```\n\ncreate schema (from SchemaField)\n```rust\nlet schema= vec![\n    SchemaField::new(\"title\".to_owned(), false, false, FieldType::Text, false, 1.0),\n    SchemaField::new(\"body\".to_owned(),true,true,FieldType::Text,false,1.0),\n    SchemaField::new(\"url\".to_owned(), false, false, FieldType::Text,false,1.0),\n];\n```\n\ncreate index\n```rust\nlet index_path=Path::new(\"C:/index/\");\n\nlet meta = IndexMetaObject {\n    id: 0,\n    name: \"test_index\".to_string(),\n    similarity:SimilarityType::Bm25f,\n    tokenizer:TokenizerType::AsciiAlphabetic,\n    stemmer: StemmerType::None,\n    stop_words: StopwordType::None,\n    frequent_words:FrequentwordType::English,\n    access_type: AccessType::Mmap,\n};\n\nlet serialize_schema=true;\nlet segment_number_bits1=11;\nlet index=create_index(index_path,meta,\u0026schema,serialize_schema,\u0026Vec::new(),segment_number_bits1,false).unwrap();\nlet _index_arc = Arc::new(RwLock::new(index));\n```\n\nopen index (alternatively to create index)\n```rust\nlet index_path=Path::new(\"C:/index/\");\nlet mut index_arc=open_index(index_path,false).await.unwrap(); \n```\n\nindex documents (from JSON)\n```rust\nlet documents_json = r#\"\n[{\"title\":\"title1 test\",\"body\":\"body1\",\"url\":\"url1\"},\n{\"title\":\"title2\",\"body\":\"body2 test\",\"url\":\"url2\"},\n{\"title\":\"title3 test\",\"body\":\"body3 test\",\"url\":\"url3\"}]\"#;\nlet documents_vec=serde_json::from_str(documents_json).unwrap();\n\nindex_arc.index_documents(documents_vec).await; \n```\n\nindex document (from Document)\n```rust\nlet document= Document::from([\n    (\"title\".to_string(), Value::String(\"title4 test\".to_string())),\n    (\"body\".to_string(), Value::String(\"body4 test\".to_string())),\n    (\"url\".to_string(), Value::String(\"url4\".to_string())),\n]);\n\nidx.0.index_document(document,FileType::None).await;\n```\n\ncommit documents\n```rust\nindex_arc.commit().await;\n```\n\nsearch index\n```rust\nlet query=\"test\".to_string();\nlet offset=0;\nlet length=10;\nlet query_type=QueryType::Intersection; \nlet result_type=ResultType::TopkCount;\nlet include_uncommitted=false;\nlet field_filter=Vec::new();\nlet result_object = index_arc.search(query, query_type, offset, length, result_type,include_uncommitted,field_filter).await;\n```\n\ndisplay results\n```rust\nlet highlights:Vec\u003cHighlight\u003e= vec![\n    Highlight {\n        field: \"body\".to_string(),\n        name:String::new(),\n        fragment_number: 2,\n        fragment_size: 160,\n        highlight_markup: true,\n        ..Default::default()\n    },\n];    \n\nlet highlighter=Some(highlighter(\u0026index_arc,highlights, result_object.query_term_strings));\nlet return_fields_filter= HashSet::new();\nlet mut index=index_arc.write().await;\nfor result in result_object.results.iter() {\n  let doc=index.get_document(result.doc_id,false,\u0026highlighter,\u0026return_fields_filter).unwrap();\n  println!(\"result {} rank {} body field {:?}\" , result.doc_id,result.score, doc.get(\"body\"));\n}\nprintln!(\"result counts {} {} {}\",result_object.results.len(), result_object.result_count, result_object.result_count_total);\n```\n\nmulti-threaded search\n```rust\nlet query_vec=vec![\"house\".to_string(),\"car\".to_string(),\"bird\".to_string(),\"sky\".to_string()];\nlet offset=0;\nlet length=10;\nlet query_type=QueryType::Union; \nlet result_type=ResultType::TopkCount;\nlet thread_number = 4;\nlet permits = Arc::new(Semaphore::new(thread_number));\nfor query in query_vec {\n    let permit_thread = permits.clone().acquire_owned().await.unwrap();\n\n    let query_clone = query.clone();\n    let index_arc_clone = index_arc.clone();\n    let query_type_clone = query_type.clone();\n    let result_type_clone = result_type.clone();\n    let offset_clone = offset;\n    let length_clone = length;\n\n    tokio::spawn(async move {\n        let rlo = index_arc_clone\n            .search(\n                query_clone,\n                query_type_clone,\n                offset_clone,\n                length_clone,\n                result_type_clone,\n                false,\n                Vec::new(),\n            )\n            .await;\n\n        println!(\"result count {}\", rlo.result_count);\n        \n        drop(permit_thread);\n    });\n}\n```\n\nindex JSON file in JSON, Newline-delimited JSON and Concatenated JSON format\n```rust\nlet file_path=Path::new(\"wiki-articles.json\");\nlet _ =index_arc.ingest_json(file_path).await;\n```\n\nindex all PDF files in directory and sub-directories\n- converts pdf to text and indexes it\n- extracts title from metatag, or first line of text, or from filename\n- extracts creation date from metatag, or from file creation date (Unix timestamp: the number of seconds since 1 January 1970)\n- copies all ingested PDF files to the \"files\" subdirectory in the index.\n- the following index schema is required (and automatically created by the console `ingest` command):\n```json\n [\n   {\n     \"field\": \"title\",\n     \"stored\": true,\n     \"indexed\": true,\n     \"field_type\": \"Text\",\n     \"boost\": 10\n   },\n   {\n     \"field\": \"body\",\n     \"stored\": true,\n     \"indexed\": true,\n     \"field_type\": \"Text\"\n   },\n   {\n     \"field\": \"url\",\n     \"stored\": true,\n     \"indexed\": false,\n     \"field_type\": \"Text\"\n   },\n   {\n     \"field\": \"date\",\n     \"stored\": true,\n     \"indexed\": false,\n     \"field_type\": \"Timestamp\",\n     \"facet\": true\n   }\n ]\n```\n\n```rust\n let file_path=Path::new(\"C:/Users/johndoe/Downloads\");\n let _ =index_arc.ingest_pdf(file_path).await;\n```\n\nindex PDF file\n```rust\nlet file_path=Path::new(\"C:/test.pdf\");\nlet file_date=Utc::now().timestamp();\nlet _ =index_arc.index_pdf_file(file_path).await;\n```\n\nindex PDF file bytes\n```rust\nlet file_date=Utc::now().timestamp();\nlet document = fs::read(file_path).unwrap();\nlet _ =index_arc.index_pdf_bytes(file_path, file_date, \u0026document).await;\n```\n\nget PDF file bytes\n```rust\nlet doc_id=0;\nlet file=index.get_file(doc_id).unwrap();\n```\n\nclear index\n```rust\nindex.clear_index();\n```\ndelete index\n```rust\nindex.delete_index();\n```\nclose index\n```rust\nindex.close_index();\n```\nseekstorm library version string\n```rust\nlet version=version();\nprintln!(\"version {}\",version);\n```\n\u003cbr/\u003e\n\n---\n### Faceted search - Quick start\n\nFacets are defined in 3 different places:\n1. The facet fields are defined in the schema at create_index.\n2. The facet field values are set in index_document at index time.\n3. The query_facets/facet_filter parameters are specified at query time.  \n   Facets are then returned in the search result object.\n\nA minimal working example of faceted indexing \u0026 search requires just 60 lines of code. But to puzzle it all together from the documentation alone might be tedious. This is why we provide a quick start example here:\n\nAdd required crates to your project\n```rust\ncargo add seekstorm\ncargo add tokio\ncargo add serde_json\n```\nAdd use declarations\n```rust\nuse std::{collections::HashSet, error::Error, path::Path, sync::Arc};\nuse seekstorm::{index::*,search::*,highlighter::*,commit::Commit};\nuse tokio::sync::RwLock;\n```\nuse an asynchronous Rust runtime\n```rust\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn Error + Send + Sync\u003e\u003e {\n```\ncreate index\n```rust\nlet index_path=Path::new(\"C:/index/\");//x\n\nlet schema_json = r#\"\n[{\"field\":\"title\",\"field_type\":\"Text\",\"stored\":false,\"indexed\":false},\n{\"field\":\"body\",\"field_type\":\"Text\",\"stored\":true,\"indexed\":true},\n{\"field\":\"url\",\"field_type\":\"Text\",\"stored\":true,\"indexed\":false},\n{\"field\":\"town\",\"field_type\":\"String\",\"stored\":false,\"indexed\":false,\"facet\":true}]\"#;\nlet schema=serde_json::from_str(schema_json).unwrap();\n\nlet meta = IndexMetaObject {\n    id: 0,\n    name: \"test_index\".to_string(),\n    similarity:SimilarityType::Bm25f,\n    tokenizer:TokenizerType::AsciiAlphabetic,\n    stemmer: StemmerType::None,\n    stop_words: StopwordType::None,\n    frequent_words:FrequentwordType::English,\n    access_type: AccessType::Mmap,\n};\n\nlet serialize_schema=true;\nlet segment_number_bits1=11;\nlet index=create_index(index_path,meta,\u0026schema,serialize_schema,\u0026Vec::new(),segment_number_bits1,false).unwrap();\nlet mut index_arc = Arc::new(RwLock::new(index));\n```\nindex documents\n```rust\nlet documents_json = r#\"\n[{\"title\":\"title1 test\",\"body\":\"body1\",\"url\":\"url1\",\"town\":\"Berlin\"},\n{\"title\":\"title2\",\"body\":\"body2 test\",\"url\":\"url2\",\"town\":\"Warsaw\"},\n{\"title\":\"title3 test\",\"body\":\"body3 test\",\"url\":\"url3\",\"town\":\"New York\"}]\"#;\nlet documents_vec=serde_json::from_str(documents_json).unwrap();\n\nindex_arc.index_documents(documents_vec).await; \n```\ncommit documents\n```rust\nindex_arc.commit().await;\n```\nsearch index\n```rust\nlet query=\"test\".to_string();\nlet offset=0;\nlet length=10;\nlet query_type=QueryType::Intersection; \nlet result_type=ResultType::TopkCount;\nlet include_uncommitted=false;\nlet field_filter=Vec::new();\nlet query_facets = vec![QueryFacet::String {field: \"age\".to_string(),prefix: \"\".to_string(),length:u16::MAX}];\nlet facet_filter=Vec::new();\n//let facet_filter = vec![FacetFilter::String { field: \"town\".to_string(),filter: vec![\"Berlin\".to_string()],}];\n\nlet facet_result_sort=Vec::new();\n\nlet result_object = index_arc.search(query, query_type, offset, length, result_type,include_uncommitted,field_filter,query_facets,facet_filter).await;\n```\ndisplay results\n```rust\nlet highlights:Vec\u003cHighlight\u003e= vec![\n        Highlight {\n            field: \"body\".to_owned(),\n            name:String::new(),\n            fragment_number: 2,\n            fragment_size: 160,\n            highlight_markup: true,\n            ..Default::default()\n        },\n    ];    \n\nlet highlighter2=Some(highlighter(\u0026index_arc,highlights, result_object.query_terms));\nlet return_fields_filter= HashSet::new();\nlet index=index_arc.write().await;\nfor result in result_object.results.iter() {\n  let doc=index.get_document(result.doc_id,false,\u0026highlighter2,\u0026return_fields_filter).unwrap();\n  println!(\"result {} rank {} body field {:?}\" , result.doc_id,result.score, doc.get(\"body\"));\n}\nprintln!(\"result counts {} {} {}\",result_object.results.len(), result_object.result_count, result_object.result_count_total);\n```\ndisplay facets\n```rust\nprintln!(\"{}\", serde_json::to_string_pretty(\u0026result_object.facets).unwrap());\n```\nend of main function\n```rust\n   Ok(())\n}\n```\n\n---\n\n## Demo time \n\n### Build a Wikipedia search engine with the SeekStorm server\n\nA quick step-by-step tutorial on how to build a Wikipedia search engine from a Wikipedia corpus using the SeekStorm server in 5 easy steps.\n\n\u003cimg src=\"assets/wikipedia_demo.png\" width=\"800\"\u003e\n\n**Download SeekStorm**\n\n[Download SeekStorm from the GitHub repository](https://github.com/SeekStorm/SeekStorm/archive/refs/heads/main.zip)  \nUnzip in a directory of your choice, open in Visual Studio code.\n\nor alternatively\n\n```\ngit clone https://github.com/SeekStorm/SeekStorm.git\n```\n\n**Build SeekStorm**\n\nInstall Rust (if not yet present): https://www.rust-lang.org/tools/install  \n\nIn the terminal of Visual Studio Code type:\n```\ncargo build --release\n```\n\n**Get Wikipedia corpus**\n\nPreprocessed English Wikipedia corpus (5,032,105 documents, 8,28 GB decompressed). \nAlthough wiki-articles.json has a .JSON extension, it is not a valid JSON file. \nIt is a text file, where every line contains a JSON object with url, title and body attributes. \nThe format is called [ndjson](https://github.com/ndjson/ndjson-spec) (\"Newline delimited JSON\").\n\n[Download Wikipedia corpus](https://www.dropbox.com/s/wwnfnu441w1ec9p/wiki-articles.json.bz2?dl=0)\n\nDecompresss Wikipedia corpus. \n\nhttps://gnuwin32.sourceforge.net/packages/bzip2.htm\n```\nbunzip2 wiki-articles.json.bz2\n```\n\nMove the decompressed wiki-articles.json to the release directory\n\n**Start SeekStorm server**\n```\ncd target/release\n```\n```\n./seekstorm_server local_ip=\"0.0.0.0\" local_port=80\n```\n\n**Indexing** \n\nType 'ingest' into the command line of the running SeekStorm server: \n```\ningest\n```\n\nThis creates the demo index  and indexes the local wikipedia file.\n\n**Start searching within the embedded WebUI**\n\nOpen embedded Web UI in browser: [http://127.0.0.1](http://127.0.0.1)\n\nEnter a query into the search box \n\n**Testing the REST API endpoints**\n\nOpen src/seekstorm_server/test_api.rest in VSC together with the VSC extension \"Rest client\" to execute API calls and inspect responses\n\n[interactive API endpoint examples](https://github.com/SeekStorm/SeekStorm/blob/main/src/seekstorm_server/test_api.rest)\n\nSet the 'individual API key' in test_api.rest to the api key displayed in the server console when you typed 'index' above.\n\n**Remove demo index**\n\nType 'delete' into the command line of the running SeekStorm server: \n```\ndelete\n```\n\n**Shutdown server**\n\nType 'quit' into the commandline of the running SeekStorm server.\n```\nquit\n```\n\n**Customizing**\n\nDo you want to use something similar for your own project?\nHave a look at the [ingest](/src/seekstorm_server/README.md#console-commands) and [web UI](/src/seekstorm_server/README.md#open-embedded-web-ui-in-browser) documentation.\n\n\n\n\n\n### Build a PDF search engine with the SeekStorm server\n\nA quick step-by-step tutorial on how to build a PDF search engine from a directory that contains PDF files using the SeekStorm server.  \nMake all your scientific papers, ebooks, resumes, reports, contracts, documentation, manuals, letters, bank statements, invoices, delivery notes searchable - at home or in your organisation.  \n\n\u003cimg src=\"assets/pdf_search.png\" width=\"800\"\u003e\n\n**Build SeekStorm**\n\nInstall Rust (if not yet present): https://www.rust-lang.org/tools/install  \n\nIn the terminal of Visual Studio Code type:\n```\ncargo build --release\n```\n\n**Download PDFium**\n\nDownload and copy the Pdfium library into the same folder as the seekstorm_server.exe: https://github.com/bblanchon/pdfium-binaries\n\n**Start SeekStorm server**\n```\ncd target/release\n```\n```\n./seekstorm_server local_ip=\"0.0.0.0\" local_port=80\n```\n\n**Indexing** \n\nChoose a directory that contains PDF files you want to index and search, e.g. your documents or download directory.\n\nType 'ingest' into the command line of the running SeekStorm server: \n```\ningest C:\\Users\\JohnDoe\\Downloads\n```\n\nThis creates the pdf_index and indexes all PDF files from the specified directory, including subdirectories.\n\n**Start searching within the embedded WebUI**\n\nOpen embedded Web UI in browser: [http://127.0.0.1](http://127.0.0.1)\n\nEnter a query into the search box \n\n**Remove demo index**\n\nType 'delete' into the command line of the running SeekStorm server: \n```\ndelete\n```\n\n**Shutdown server**\n\nType 'quit' into the commandline of the running SeekStorm server.\n```\nquit\n```\n\n\n\n\n\n### Online Demo: DeepHN Hacker News search\n\nFull-text search 30M Hacker News posts AND linked web pages\n\n[DeepHN.org](https://deephn.org/)\n\n\u003cimg src=\"assets/deephn_demo.png\" width=\"800\"\u003e\n\nThe DeepHN demo is still based on the SeekStorm C# codebase.  \nWe are currently porting all required missing features.  \nSee roadmap below.  \n\n---\n\n## Roadmap\n\nThe Rust port is not yet feature complete. The following features are currently ported or added.\n\n**Porting** \n* ✅ Delete document\n* ✅ Faceted search\n* ✅ Sorting of results by any field\n* ✅ Unicode character folding/normalization tokenizer (diacritics, accents, umlauts, bold, italic, full-width ...)\n* ✅ Tokenizer with Chinese word segmentation\n* Autosuggestion, spelling correction, instant search\n* Fuzzy search\n* Intra-query concurrency\n\n**Improvements**\n* ✅ Better REST API documentation: integrated OpenAPI generator\n* 👷 Faster indexing\n* Relevancy benchmarks: BeIR, MS MARCO\n\n**New features**\n* ✅ Docker file and container image\n* ✅ Stemming for 18 languages\n* More tokenizer types (Japanese, Korean)\n* Native vector search (currently PoC)\n* Distributed search cluster (currently PoC)\n* S3 object storage compatible index: cloud-native split of storage and compute\n* WebAssembly (Wasm)\n* Wrapper/bindings in JavaScript, Python, Java, C#, C, Go for the SeekStorm Rust library\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSeekStorm%2FSeekStorm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSeekStorm%2FSeekStorm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSeekStorm%2FSeekStorm/lists"}