Leomrlin commented on code in PR #716: URL: https://github.com/apache/geaflow/pull/716#discussion_r2703125399
########## geaflow-ai/src/main/java/org/apache/geaflow/ai/operator/SearchUtils.java: ########## @@ -0,0 +1,108 @@ +/* + * 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. + */ + +package org.apache.geaflow.ai.operator; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +public class SearchUtils { + + // Set of excluded characters: these will be replaced with spaces in formatQuery + private static final Set<Character> EXCLUDED_CHARS = new HashSet<>(Arrays.asList( + '*', '#', '-', '?', '`', '{', '}', '[', ']', '(', ')', '>', '<', ':', '/', '.' + )); + + // Set of allowed characters for validation in isAllAllowedChars + // Includes: digits (0-9), and some common safe symbols + private static final Set<Character> IGNORE_CHARS = buildIgnoredChars(); + + /** + * Builds the set of allowed characters for input validation. + * Includes alphanumeric characters and selected common symbols. + * + * @return an unmodifiable set of ignored characters + */ + private static Set<Character> buildIgnoredChars() { + Set<Character> ignored = new HashSet<>(EXCLUDED_CHARS); Review Comment: Removed `EXCLUDED_CHARS` from `IGNORE_CHARS` -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
