net.consensys.tools.ipfs.ipfsstore.dto.query.Query类的使用及代码示例

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

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

Query介绍

[英]"Query" accumulates filters and acts as a query builder for each allowed operation
[中]“查询”累积过滤器,并充当每个允许操作的查询生成器

代码示例

代码示例来源:origin: ConsenSys/IPFS-Store

public static Query newQuery() {
  return new Query();
}

代码示例来源:origin: ConsenSys/IPFS-Store

@JsonIgnore
  public boolean isEmpty() {
    return this.getFilterClauses().isEmpty();
  }
}

代码示例来源:origin: ConsenSys/IPFS-Store

@Override
public Page<E> findByfullTextSearch(String fullTextCriteria, Pageable pagination) {
  log.debug("Find all [criteria: {}, pagination: {}]", fullTextCriteria, pagination);
  
  if(fullTextFields.isEmpty()) {
    log.warn("Can't perform a full text search. no fields configured [fullTextFields]");
    return null;
  }
  Query query = Query.newQuery();
  query.fullText(fullTextFields.toArray(new String[fullTextFields.size()]), fullTextCriteria);
  Page<E> result = this.search(query, pagination);
  log.debug("Find all [criteria: {}, pagination: {}] : {}", fullTextCriteria, pagination, result);
  return result;
}

代码示例来源:origin: ConsenSys/IPFS-Store

/**
 * Return the content metadata (index, ID, content_type, hash and attributes)
 *
 * @param indexName Index name
 * @param id        Document Unique identifier
 * @return Metadata (index, ID, content_type, hash and attributes)
 * @throws IPFSStoreException
 */
public Metadata getMetadataById(String indexName, String id) throws IPFSStoreException {
  Query query = Query.newQuery().equals(ID_ATTRIBUTE, id);
  Page<Metadata> searchResult = this.wrapper.search(indexName, query, PageRequest.of(0, 1));
  if (searchResult.getTotalElements() == 0) {
    throw new NotFoundException("Content [indexName: " + indexName + ", id: "+ id + "] not found in the index");
  }
  return searchResult.getContent().get(0);
}

代码示例来源:origin: ConsenSys/IPFS-Store

@Override
public Metadata getFileMetadataByHash(Optional<String> index, String hash)
    throws NotFoundException {
  Query query = new Query().equals(IndexDao.HASH_INDEX_KEY, hash.toLowerCase()); // TODO ES
                                          // case
                                          // sensitive
                                          // analyser
  Page<Metadata> search = this.searchFiles(index, query, PageRequest.of(0, 1));
  if (search.getTotalElements() == 0) {
    throw new NotFoundException(
        "File [hash=" + hash + "] not found in the index [" + index + "]");
  }
  return search.getContent().get(0);
}

代码示例来源:origin: ConsenSys/IPFS-Store

if (query == null || query.isEmpty()) {
  return QueryBuilders.matchAllQuery();
query.getFilterClauses().forEach(f -> {

代码示例来源:origin: ConsenSys/IPFS-Store

query = Query.newQuery();

代码示例来源:origin: ConsenSys/IPFS-Store

/**
 * Return the content metadata (index, ID, content_type, hash and attributes)
 *
 * @param indexName Index name
 * @param hash        document hash
 * @return Metadata (index, ID, content_type, hash and attributes)
 * @throws IPFSStoreException
 */
public Metadata getMetadataByHash(String indexName, String hash) throws IPFSStoreException {
  Query query = Query.newQuery().equals(HASH_ATTRIBUTE, hash);
  Page<Metadata> searchResult = this.wrapper.search(indexName, query, PageRequest.of(0, 1));
  if (searchResult.getTotalElements() == 0) {
    throw new NotFoundException("Content [indexName: " + indexName + ", hash: "+ hash + "] not found in the index");
  }
  return searchResult.getContent().get(0);
}

代码示例来源:origin: ConsenSys/IPFS-Store

public static Query newQuery(List<Filter> filterClauses) {
  return new Query(filterClauses);
}

相关文章