com.psddev.dari.db.Query.isReferenceOnly()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(146)

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

Query.isReferenceOnly介绍

暂无

代码示例

代码示例来源:origin: perfectsense/dari

private Object findCachedObject(UUID id, Query<?> query) {
  Object object = objectCache.getIfPresent(id);
  if (object == null && query.isReferenceOnly()) {
    object = referenceCache != null ? referenceCache.getIfPresent(id) : null;
  }
  if (object != null) {
    Class<?> objectClass = query.getObjectClass();
    if (objectClass != null && !objectClass.isInstance(object)) {
      object = null;
    }
  }
  return object;
}

代码示例来源:origin: perfectsense/dari

private boolean checkFunnelCache(Query<?> query) {
  return query.isCache()
      && !query.isReferenceOnly()
      && isEnableFunnelCache()
      && !Boolean.TRUE.equals(query.getOptions().get(Database.DISABLE_FUNNEL_CACHE_QUERY_OPTION))
      && funnelCache != null;
}

代码示例来源:origin: perfectsense/dari

@Override
public <T> PaginatedResult<T> readPartial(Query<T> query, long offset, int limit) {
  Client client = openConnection();
  try {
    Set<UUID> typeIds = query.getConcreteTypeIds(this);
    String[] typeIdStrings = typeIds.size() == 0
        ? new String[] { "_all" }
        : typeIds.stream().map(UUID::toString).toArray(String[]::new);
    SearchResponse response = client.prepareSearch(getIndexName())
        .setFetchSource(!query.isReferenceOnly())
        .setTypes(typeIdStrings)
        .setQuery(predicateToQueryBuilder(query.getPredicate()))
        .setFrom((int) offset)
        .setSize(limit)
        .execute()
        .actionGet();
    SearchHits hits = response.getHits();
    List<T> items = new ArrayList<>();
    for (SearchHit hit : hits.getHits()) {
      items.add(createSavedObjectWithHit(hit, query));
    }
    return new PaginatedResult<>(offset, limit, hits.getTotalHits(), items);
  } finally {
    closeConnection(client);
  }
}

代码示例来源:origin: perfectsense/dari

/**
 * Queries the underlying Solr server with the given {@code query}
 * and options from the given {@code query}.
 */
public QueryResponse queryWithOptions(SolrQuery solrQuery, Query<?> query) {
  if (query != null && query.isReferenceOnly()) {
    solrQuery.setFields(ID_FIELD, TYPE_ID_FIELD);
  } else {
    solrQuery.setFields("*", SCORE_FIELD);
  }
  Stats.Timer timer = STATS.startTimer();
  Profiler.Static.startThreadEvent(QUERY_PROFILER_EVENT);
  try {
    return openQueryConnection(query).query(solrQuery, SolrRequest.METHOD.POST);
  } catch (SolrServerException ex) {
    throw new DatabaseException(this, String.format(
        "Unable to read from the Solr server using [%s]!",
        solrQuery), ex);
  } finally {
    double duration = timer.stop(QUERY_STATS_OPERATION);
    Profiler.Static.stopThreadEvent(solrQuery);
    LOGGER.debug(
        "Read from the Solr server using [{}] in [{}]ms",
        solrQuery, duration);
  }
}

代码示例来源:origin: perfectsense/dari

selectFields.add(recordTypeIdField);
boolean referenceOnly = query.isReferenceOnly();

代码示例来源:origin: perfectsense/dari

objectState.setResolveInvisible(query.isResolveInvisible());
if (query.isReferenceOnly()) {
  objectState.setStatus(StateStatus.REFERENCE_ONLY);

相关文章