本文整理了Java中net.consensys.tools.ipfs.ipfsstore.dto.query.Query
类的一些代码示例,展示了Query
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query
类的具体详情如下:
包路径:net.consensys.tools.ipfs.ipfsstore.dto.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);
}
内容来源于网络,如有侵权,请联系作者删除!