Skip to content

Commit

Permalink
Added a --v2 hidden in the ingest client.
Browse files Browse the repository at this point in the history
  • Loading branch information
fulmicoton committed Nov 8, 2023
1 parent d5264f0 commit bda06f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions quickwit/quickwit-cli/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ pub fn build_index_command() -> Command {
.short('w')
.help("Wait for all documents to be commited and available for search before exiting")
.action(ArgAction::SetTrue),
// TODO remove me after Quickwit 0.7.
Arg::new("v2")
.long("v2")
.help("Ingest v2 (experimental! Do not use me.)")
.hide(true)
.action(ArgAction::SetTrue),
Arg::new("force")
.long("force")
.short('f')
Expand Down Expand Up @@ -207,6 +213,7 @@ pub struct IngestDocsArgs {
pub input_path_opt: Option<PathBuf>,
pub batch_size_limit_opt: Option<Byte>,
pub commit_type: CommitType,
pub ingest_v2: bool,
}

#[derive(Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -323,6 +330,7 @@ impl IndexCliCommand {
let index_id = matches
.remove_one::<String>("index")
.expect("`index` should be a required arg.");
let ingest_v2 = matches.get_flag("v2");
let input_path_opt = if let Some(input_path) = matches.remove_one::<String>("input-path") {
Uri::from_str(&input_path)?
.filepath()
Expand Down Expand Up @@ -352,6 +360,7 @@ impl IndexCliCommand {
input_path_opt,
batch_size_limit_opt,
commit_type,
ingest_v2,
}))
}

Expand Down Expand Up @@ -812,6 +821,7 @@ pub async fn ingest_docs_cli(args: IngestDocsArgs) -> anyhow::Result<()> {
batch_size_limit_opt,
Some(&update_progress_bar),
args.commit_type,
args.ingest_v2,
)
.await?;
progress_bar.finish();
Expand Down
7 changes: 6 additions & 1 deletion quickwit/quickwit-rest-client/src/rest_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,13 @@ impl QuickwitClient {
batch_size_limit_opt: Option<usize>,
on_ingest_event: Option<&(dyn Fn(IngestEvent) + Sync)>,
last_block_commit: CommitType,
ingest_v2: bool,
) -> Result<(), Error> {
let ingest_path = format!("{index_id}/ingest");
let ingest_path = if ingest_v2 {
format!("{index_id}/ingest-v2")
} else {
format!("{index_id}/ingest")
};
let batch_size_limit = batch_size_limit_opt.unwrap_or(INGEST_CONTENT_LENGTH_LIMIT);
let mut batch_reader = match ingest_source {
IngestSource::File(filepath) => {
Expand Down

0 comments on commit bda06f0

Please sign in to comment.