Skip to content

Commit 97d6ffe

Browse files
committed
chore: update default port
Signed-off-by: Xin Liu <sam@secondstate.io>
1 parent bb3d9db commit 97d6ffe

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Keyword search in RAG scenarios is a lightweight and efficient retrieval method.
3232
- Run `kw-search-server`
3333

3434
```bash
35-
# Run server on default port 9069
35+
# Run server on default port 12306
3636
./kw-search-server
3737

3838
# Run server on custom port, e.g. 10086
@@ -53,9 +53,9 @@ Keyword search in RAG scenarios is a lightweight and efficient retrieval method.
5353
--download-url-prefix <DOWNLOAD_URL_PREFIX>
5454
Download URL prefix, format: `http(s)://{IPv4_address}:{port}` or `http(s)://{domain}:{port}`
5555
--socket-addr <SOCKET_ADDR>
56-
Socket address of llama-proxy-server instance. For example, `0.0.0.0:9069`
56+
Socket address of llama-proxy-server instance. For example, `0.0.0.0:12306`
5757
--port <PORT>
58-
Socket address of llama-proxy-server instance [default: 9069]
58+
Socket address of llama-proxy-server instance [default: 12306]
5959
-h, --help
6060
Print help
6161
-V, --version
@@ -72,7 +72,7 @@ To create an index for a list of documents, you can use the `/v1/index/create` e
7272

7373
```bash
7474
# Create index from a list of files
75-
curl --location 'http://localhost:9069/v1/index/create' \
75+
curl --location 'http://localhost:12306/v1/index/create' \
7676
--form 'file1=@"paris.txt"' \
7777
--form 'file2=@"paris.md"'
7878
```
@@ -104,7 +104,7 @@ To create an index for a list of documents, you can use the `/v1/index/create` e
104104

105105
```bash
106106
# Create index from a list of chunks
107-
curl --location 'http://localhost:9069/v1/index/create' \
107+
curl --location 'http://localhost:12306/v1/index/create' \
108108
--header 'Content-Type: application/json' \
109109
--data '{
110110
"documents": [
@@ -164,7 +164,7 @@ To create an index for a list of documents, you can use the `/v1/index/create` e
164164
To perform a keyword search, you can use the `/v1/search` endpoint:
165165

166166
```bash
167-
curl --location 'http://localhost:9069/v1/search' \
167+
curl --location 'http://localhost:12306/v1/search' \
168168
--header 'Content-Type: application/json' \
169169
--data '{
170170
"query": "What is the location of Paris, France along the Seine river?",

src/main.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use tracing::{debug, error, info, warn, Level};
2525
use url::Url;
2626

2727
// default port of Keyword Search Server
28-
const DEFAULT_PORT: &str = "9069";
28+
const DEFAULT_PORT: &str = "12306";
2929

3030
const MEMORY_BUDGET_IN_BYTES: usize = 100_000_000;
3131

@@ -203,7 +203,7 @@ async fn index_document_handler(
203203
}
204204
"application/json" => {
205205
info!("Processing as JSON request");
206-
let payload = match axum::Json::<IndexRequest>::from_request(request, &()).await {
206+
let index_request = match axum::Json::<IndexRequest>::from_request(request, &()).await {
207207
Ok(Json(payload)) => payload,
208208
Err(e) => {
209209
error!(error = %e, "Failed to parse JSON request");
@@ -218,7 +218,7 @@ async fn index_document_handler(
218218
});
219219
}
220220
};
221-
process_json(payload).await
221+
process_json(index_request).await
222222
}
223223
_ => {
224224
warn!(content_type = content_type, "Unsupported content type");
@@ -494,7 +494,10 @@ async fn process_json(request: IndexRequest) -> Json<IndexResponse> {
494494
// Create index directory
495495
info!("Starting index creation");
496496
let index_storage_dir = std::env::current_dir().unwrap().join(INDEX_STORAGE_DIR);
497-
let index_name = format!("index-{}", uuid::Uuid::new_v4());
497+
let index_name = match request.name {
498+
Some(name) => name,
499+
None => format!("index-{}", uuid::Uuid::new_v4()),
500+
};
498501
let index_path = index_storage_dir.as_path().join(&index_name);
499502
if !index_path.exists() {
500503
debug!(path = %index_path.display(), "Creating index directory");

0 commit comments

Comments
 (0)