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

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

本文整理了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

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

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

  1. public static org.apache.lucene.search.Query convertQuery(final org.apache.nifi.provenance.search.Query query) {
  2. if (query.getStartDate() == null && query.getEndDate() == null && query.getSearchTerms().isEmpty()) {
  3. return new MatchAllDocsQuery();
  4. }
  5. final BooleanQuery luceneQuery = new BooleanQuery();
  6. for (final SearchTerm searchTerm : query.getSearchTerms()) {
  7. final String searchValue = searchTerm.getValue();
  8. if (searchValue == null) {
  9. throw new IllegalArgumentException("Empty search value not allowed (for term '" + searchTerm.getSearchableField().getFriendlyName() + "')");
  10. }
  11. if (searchValue.contains("*") || searchValue.contains("?")) {
  12. luceneQuery.add(new BooleanClause(new WildcardQuery(new Term(searchTerm.getSearchableField().getSearchableFieldName(), searchTerm.getValue().toLowerCase())), Occur.MUST));
  13. } else {
  14. luceneQuery.add(new BooleanClause(new TermQuery(new Term(searchTerm.getSearchableField().getSearchableFieldName(), searchTerm.getValue().toLowerCase())), Occur.MUST));
  15. }
  16. }
  17. final Long minBytes = query.getMinFileSize() == null ? null : DataUnit.parseDataSize(query.getMinFileSize(), DataUnit.B).longValue();
  18. final Long maxBytes = query.getMaxFileSize() == null ? null : DataUnit.parseDataSize(query.getMaxFileSize(), DataUnit.B).longValue();
  19. if (minBytes != null || maxBytes != null) {
  20. luceneQuery.add(NumericRangeQuery.newLongRange(SearchableFields.FileSize.getSearchableFieldName(), minBytes, maxBytes, true, true), Occur.MUST);
  21. }
  22. final Long minDateTime = query.getStartDate() == null ? null : query.getStartDate().getTime();
  23. final Long maxDateTime = query.getEndDate() == null ? null : query.getEndDate().getTime();
  24. if (maxDateTime != null || minDateTime != null) {
  25. luceneQuery.add(NumericRangeQuery.newLongRange(SearchableFields.EventTime.getSearchableFieldName(), minDateTime, maxDateTime, true, true), Occur.MUST);
  26. }
  27. return luceneQuery;
  28. }

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

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

相关文章