当前位置: 首页>>代码示例>>Java>>正文


Java SolrDocument.get方法代码示例

本文整理汇总了Java中org.apache.solr.common.SolrDocument.get方法的典型用法代码示例。如果您正苦于以下问题:Java SolrDocument.get方法的具体用法?Java SolrDocument.get怎么用?Java SolrDocument.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.common.SolrDocument的用法示例。


在下文中一共展示了SolrDocument.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkIndex

import org.apache.solr.common.SolrDocument; //导入方法依赖的package包/类
/**
 * Integrity check.
 */
public void checkIndex()
{
   try
   {
      SolrQuery query = new SolrQuery("*:*");
      query.setFilterQueries("*");
      query.setStart(0);
      Iterator<SolrDocument> it = solrDao.scroll(query);
      while (it.hasNext())
      {
         SolrDocument doc = it.next();
         Long pid = (Long) doc.get("id");
         Product product = productService.systemGetProduct(pid);
         if (product == null)
         {
            Long id = (Long) doc.getFieldValue("id");
            LOGGER.warn("Removing unknown product " + id + " from solr index");
            try
            {
               solrDao.remove(id);
               // decrease the offset, because a product has been removed
               query.setStart(query.getStart() - 1);
            }
            catch (IOException e)
            {
               LOGGER.error("Cannot remove Solr entry " + id, e);
            }
         }
      }
   }
   catch (IOException|SolrServerException ex)
   {
      LOGGER.error("Cannot check the index", ex);
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:39,代码来源:SearchService.java

示例2: nextInner

import org.apache.solr.common.SolrDocument; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected boolean nextInner() throws IOException {
  if (list == null || pos >= list.size()) {
    return false;
  }
  SolrDocument doc = list.get(pos++);
  key = (K) doc.get(store.getMapping().getPrimaryKey());
  persistent = store.newInstance(doc, fields);
  return true;
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:12,代码来源:SolrResult.java

示例3: newInstance

import org.apache.solr.common.SolrDocument; //导入方法依赖的package包/类
public T newInstance(SolrDocument doc, String[] fields) throws IOException {
  T persistent = newPersistent();
  if (fields == null) {
    fields = fieldMap.keySet().toArray(new String[fieldMap.size()]);
  }
  String pk = mapping.getPrimaryKey();
  for (String f : fields) {
    Field field = fieldMap.get(f);
    Schema fieldSchema = field.schema();
    String sf = null;
    if (pk.equals(f)) {
      sf = f;
    } else {
      sf = mapping.getSolrField(f);
    }
    Object sv = doc.get(sf);
    if (sv == null) {
      continue;
    }

    Object v = deserializeFieldValue(field, fieldSchema, sv, persistent);
    persistent.put(field.pos(), v);
    persistent.setDirty(field.pos());

  }
  persistent.clearDirty();
  return persistent;
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:29,代码来源:SolrStore.java

示例4: showDebugOutput

import org.apache.solr.common.SolrDocument; //导入方法依赖的package包/类
/**
 * Anzeige von Debug-Informationen
 * @param response
 * @param results
 */
private void showDebugOutput(QueryResponse response, SolrDocumentList results) {
    // interne Interpretation der eingegebenen Suchanfrage
    System.out.println("rawquerystring: " + response.getDebugMap().get("rawquerystring"));
    System.out.println("parsedquery_toString: " + response.getDebugMap().get("parsedquery_toString"));

    // Erläuterung zur Scoreberechnung der einzelnen Dokumente
    for (SolrDocument doc : results) {
        String id = (String) doc.get("id");
        System.out.println("*** Scorewert für Dokument " + id + " ***");
        System.out.println(response.getExplainMap().get(id));
    }
}
 
开发者ID:saschaszott,项目名称:suma-tech,代码行数:18,代码来源:SolrSearcherWithAuth.java

示例5: querySolrIndex

import org.apache.solr.common.SolrDocument; //导入方法依赖的package包/类
/**
 * Returns all patterns from the index and their features for reverb and the
 * wordnet distance and the overall boa-boaScore.
 * 
 * @param propertyUri the property URI
 * @return a list of patterns
 */
private static Set<Pattern> querySolrIndex(String propertyUri) {

    Map<Integer, Pattern> patterns = new HashMap<>();

    try {

        SolrQuery query = new SolrQuery("uri:\"" + propertyUri + "\"");
        query.addField("REVERB");
        query.addField("WORDNET_DISTANCE");
        query.addField("SUPPORT_NUMBER_OF_PAIRS_LEARNED_FROM");
        query.addField("pos");
        query.addField("boa-score");
        query.addField("nlr-var");
        query.addField("nlr-no-var");
        query.setRows(10000);
        QueryResponse response = server.query(query);
        SolrDocumentList docList = response.getResults();

        // return the first list of types
        for (SolrDocument d : docList) {

            Pattern pattern = new Pattern();
            pattern.naturalLanguageRepresentation = (String) d.get("nlr-var");
            pattern.naturalLanguageRepresentationWithoutVariables = (String) d.get("nlr-no-var");
            pattern.features.put("REVERB", Double.valueOf((String) d.get("REVERB")));
            pattern.features.put("WORDNET_DISTANCE", Double.valueOf((String) d.get("WORDNET_DISTANCE")));
            pattern.features.put("SUPPORT_NUMBER_OF_PAIRS_LEARNED_FROM", Double.valueOf((String) d.get("SUPPORT_NUMBER_OF_PAIRS_LEARNED_FROM")));
            pattern.posTags = (String) d.get("pos");
            pattern.boaScore = Double.valueOf((String) d.get("boa-score"));
            pattern.naturalLanguageScore = calculateNaturalLanguageScore(pattern);

            // since ?D? and ?R? are removed so two patterns might look the
            // same
            if (isSuitable(pattern)) {

                // merge the pattern
                if (patterns.containsKey(pattern.hashCode())) {

                    Pattern p = patterns.get(pattern.hashCode());
                    p.features.put("REVERB", pattern.features.get("REVERB") + p.features.get("REVERB"));
                    p.features.put("WORDNET_DISTANCE", pattern.features.get("WORDNET_DISTANCE") + p.features.get("WORDNET_DISTANCE"));
                    p.features.put("SUPPORT_NUMBER_OF_PAIRS_LEARNED_FROM", pattern.features.get("SUPPORT_NUMBER_OF_PAIRS_LEARNED_FROM") + p.features.get("SUPPORT_NUMBER_OF_PAIRS_LEARNED_FROM"));
                    p.boaScore += pattern.boaScore;
                    p.naturalLanguageScore += pattern.naturalLanguageScore;
                    patterns.put(pattern.hashCode(), p);
                }
                else {

                    patterns.put(pattern.hashCode(), pattern);
                }
            }
        }
    }
    catch (SolrServerException e) {

        System.out.println("Could not execute query: " + e);
        e.printStackTrace();
    }
    return new HashSet<>(patterns.values());
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:68,代码来源:BoaPatternSelector.java


注:本文中的org.apache.solr.common.SolrDocument.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。