-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SOLR-17022: Support for glob patterns for fields in Export handler, S…
…tream handler and with SelectStream streaming expression (#1996) * Adding support for Glob patterns in Export handler and Select stream handler using the same logic to match glob patterns to fields as is used in select requests
- Loading branch information
1 parent
9cdf021
commit 3a69654
Showing
9 changed files
with
187 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
solr/solrj/src/java/org/apache/solr/common/util/GlobPatternUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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.solr.common.util; | ||
|
||
import java.nio.file.FileSystems; | ||
import java.nio.file.Paths; | ||
|
||
/** Provides methods for matching glob patterns against input strings. */ | ||
public class GlobPatternUtil { | ||
|
||
/** | ||
* Matches an input string against a provided glob patterns. This uses Java NIO FileSystems | ||
* PathMatcher to match glob patterns in the same way to how glob patterns are matches for file | ||
* paths, rather than implementing our own glob pattern matching. | ||
* | ||
* @param pattern the glob pattern to match against | ||
* @param input the input string to match against a glob pattern | ||
* @return true if the input string matches the glob pattern, false otherwise | ||
*/ | ||
public static boolean matches(String pattern, String input) { | ||
return FileSystems.getDefault().getPathMatcher("glob:" + pattern).matches(Paths.get(input)); | ||
} | ||
} |
Oops, something went wrong.