ryerraguntla commented on code in PR #3498:
URL: https://github.com/apache/iggy/pull/3498#discussion_r3459397146


##########
core/connectors/sources/meilisearch_source/src/lib.rs:
##########
@@ -0,0 +1,898 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use async_trait::async_trait;
+use iggy_connector_sdk::{
+    ConnectorState, Error, ProducedMessage, ProducedMessages, Schema, Source,
+    retry::{exponential_backoff, jitter, parse_duration},
+    source_connector,
+};
+use meilisearch_sdk::{
+    client::Client,
+    errors::{
+        Error as MeilisearchSdkError, ErrorCode as MeilisearchErrorCode,
+        ErrorType as MeilisearchErrorType,
+    },
+};
+use secrecy::{ExposeSecret, SecretString};
+use serde::{Deserialize, Serialize};
+use serde_json::{Value, json};
+use std::{future::Future, time::Duration};
+use tokio::{sync::Mutex, time::sleep};
+use tracing::{info, warn};
+use url::Url;
+
+source_connector!(MeilisearchSource);
+
+const CONNECTOR_NAME: &str = "Meilisearch source";
+const DEFAULT_BATCH_SIZE: usize = 100;
+const DEFAULT_POLLING_INTERVAL: &str = "5s";
+const DEFAULT_INCLUDE_METADATA: bool = false;
+const DEFAULT_TIMEOUT: &str = "30s";
+const DEFAULT_RETRY_DELAY: &str = "500ms";
+const DEFAULT_MAX_RETRY_DELAY: &str = "5s";
+const DEFAULT_MAX_RETRIES: u32 = 3;
+const DEFAULT_MAX_OPEN_RETRIES: u32 = 5;
+const PRIMARY_KEY_SORT_DIRECTION: &str = "asc";
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct MeilisearchSourceConfig {
+    pub url: String,
+    pub index: String,
+    #[serde(serialize_with = 
"iggy_common::serde_secret::serialize_optional_secret")]
+    pub api_key: Option<SecretString>,
+    pub query: Option<String>,
+    pub filter: Option<Value>,

Review Comment:
    filter: Option<Value> config type undocumented for array syntax
     filter accepts string or nested array-of-strings/arrays. Array form only 
works with JSON config (plugin_config_format = "json") not TOML. README says 
"string or array" with zero example. Config.toml shows only
     string form. Operators won't know how to use array syntax. **Fix:** add 
array example to README + note it requires JSON config format.  
   
   
   Additional Information:   
   - lib.rs:59 — pub filter: Option<Value> — field declaration in public config 
struct
    - README.md:12 — `filter`: Optional Meilisearch filter expression or array. 
— single-line doc, no example of array syntax, no note that array form requires 
plugin_config_format = "json"
   - config.toml:24 — plugin_config_format = "json" is set, but no filter field 
appears in the config example at all (lines 34-45)
   
     The gap: config.toml omits filter entirely, README:12 mentions array but 
gives no example, and nowhere is it stated that array form requires the JSON 
config format (which is only set at config.toml:24). String filter works in 
both TOML and JSON config; array filter requires JSON. That distinction is 
never documented.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to