-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOLR-17022: Support for glob patterns for fields in Export handler, Stream handler and with SelectStream streaming expression #1996
Changes from all commits
b210b1e
8a04a11
fe66c1f
23626fb
ac25ebb
bfe31fa
fad2f18
0d862cf
f1c62f9
0382445
19e97ae
7f7b49d
91133ae
c1ebac1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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; | ||
justinrsweeney marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import java.nio.file.FileSystems; | ||
import java.nio.file.Paths; | ||
|
||
/** Provides methods for matching glob patterns against input strings. */ | ||
public class GlobPatternUtil { | ||
dsmiley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* 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)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is bizarre just for some field wildcard support. If there is a reason we use FileSystems then a comment is necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took a look at how it's implemented. If only we could call ZipUtils.toRegexPattern but the class is package protected. It's a shame to recompile the glob on each call to matches! |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't SelectStream also use SolrReturnFields and not use lower level GlobPattern stuff (it's something SRF can handle)?
Disclaimer: I haven't looked at this PR in a long time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solrj-streaming
does not currently have a dependency oncore
, in fact currently I thinkcore
depends onsolrj-streaming
. I didn't want to refactor SolrReturnFields to live elsewhere given the scope of this PR so not using that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right; of course.