org.apache.nifi.provenance.search.Query.getMaxFileSize()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(233)

本文整理了Java中org.apache.nifi.provenance.search.Query.getMaxFileSize方法的一些代码示例,展示了Query.getMaxFileSize的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getMaxFileSize方法的具体详情如下:
包路径:org.apache.nifi.provenance.search.Query
类名称:Query
方法名:getMaxFileSize

Query.getMaxFileSize介绍

暂无

代码示例

代码示例来源:origin: apache/nifi

if (query.getMaxFileSize() != null) {
  final long maxFileSize = DataUnit.parseDataSize(query.getMaxFileSize(), DataUnit.B).longValue();
  if (event.getFileSize() > maxFileSize) {
    return false;

代码示例来源:origin: apache/nifi

public static org.apache.lucene.search.Query convertQuery(final org.apache.nifi.provenance.search.Query query) {
  if (query.getStartDate() == null && query.getEndDate() == null && query.getSearchTerms().isEmpty()) {
    return new MatchAllDocsQuery();
  }
  final BooleanQuery luceneQuery = new BooleanQuery();
  for (final SearchTerm searchTerm : query.getSearchTerms()) {
    final String searchValue = searchTerm.getValue();
    if (searchValue == null) {
      throw new IllegalArgumentException("Empty search value not allowed (for term '" + searchTerm.getSearchableField().getFriendlyName() + "')");
    }
    if (searchValue.contains("*") || searchValue.contains("?")) {
      luceneQuery.add(new BooleanClause(new WildcardQuery(new Term(searchTerm.getSearchableField().getSearchableFieldName(), searchTerm.getValue().toLowerCase())), Occur.MUST));
    } else {
      luceneQuery.add(new BooleanClause(new TermQuery(new Term(searchTerm.getSearchableField().getSearchableFieldName(), searchTerm.getValue().toLowerCase())), Occur.MUST));
    }
  }
  final Long minBytes = query.getMinFileSize() == null ? null : DataUnit.parseDataSize(query.getMinFileSize(), DataUnit.B).longValue();
  final Long maxBytes = query.getMaxFileSize() == null ? null : DataUnit.parseDataSize(query.getMaxFileSize(), DataUnit.B).longValue();
  if (minBytes != null || maxBytes != null) {
    luceneQuery.add(NumericRangeQuery.newLongRange(SearchableFields.FileSize.getSearchableFieldName(), minBytes, maxBytes, true, true), Occur.MUST);
  }
  final Long minDateTime = query.getStartDate() == null ? null : query.getStartDate().getTime();
  final Long maxDateTime = query.getEndDate() == null ? null : query.getEndDate().getTime();
  if (maxDateTime != null || minDateTime != null) {
    luceneQuery.add(NumericRangeQuery.newLongRange(SearchableFields.EventTime.getSearchableFieldName(), minDateTime, maxDateTime, true, true), Occur.MUST);
  }
  return luceneQuery;
}

代码示例来源:origin: apache/nifi

requestDto.setEndDate(query.getEndDate());
requestDto.setMinimumFileSize(query.getMinFileSize());
requestDto.setMaximumFileSize(query.getMaxFileSize());
requestDto.setMaxResults(query.getMaxResults());
if (query.getSearchTerms() != null) {

相关文章