[
https://issues.apache.org/jira/browse/SOLR-10132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15870204#comment-15870204
]
Christine Poerschke commented on SOLR-10132:
--------------------------------------------
bq. ... still need to figure out what to do with the check for numeric facets
...
Something like this might be hacky but should work:
{code}
public class RegexBytesRefFilter extends SubstringBytesRefFilter {
final private String regex;
final private Pattern compiled;
public RegexBytesRefFilter(String regex) {
super(regex, false);
this.regex = regex;
this.compiled = Pattern.compile(regex);
}
@Override
protected boolean includeString(String term) {
Matcher m = compiled.matcher(term);
return m.matches();
}
}
{code}
In SOLR-9914 we were puzzled by the check also, perhaps its removal could be
considered (outside the scope of this ticket) i.e. just disallow/throw if any
_contains_ (or _matches_ or other string-matching) is used with numeric facets?
> Support facet.matches to cull facets returned with a regex
> ----------------------------------------------------------
>
> Key: SOLR-10132
> URL: https://issues.apache.org/jira/browse/SOLR-10132
> Project: Solr
> Issue Type: New Feature
> Security Level: Public(Default Security Level. Issues are Public)
> Components: faceting
> Affects Versions: 6.4.1
> Reporter: Gus Heck
> Attachments: SOLR-10132.patch
>
>
> I recently ran into a case where I really wanted to only return the next
> level of a hierarchical facet, and while I was able to do that with a
> coordinated set of dynamic fields, it occurred to me that this would have
> been much much easier if I could have simply used PathHierarchyTokenizer and
> written
> &facet.matches="/my/current/prefix/[^/]+$"
> thereby limiting the returned facets to the next level down and not return
> the additional N levels I didn't (yet) want to display (numbering in the
> thousands near the top of the tree). I suspect there are other good use
> cases, and the patch seemed relatively tractable.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]