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


Java SimpleOrderedMap.add方法代码示例

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


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

示例1: toNamedList

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
/** Convert this to a NamedList */
public NamedList<Object> toNamedList() {
    final SimpleOrderedMap<Object> result = new SimpleOrderedMap<>();

    for(Iterator<String> it=getParameterNamesIterator(); it.hasNext(); ) {
        final String name = it.next();
        final String [] values = getParams(name);
        if(values.length==1) {
            result.add(name,values[0]);
        } else {
            // currently no reason not to use the same array
            result.add(name,values);
        }
    }
    return result;
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:17,代码来源:SolrParams.java

示例2: handleExtract

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
public void handleExtract(SolrQueryRequest req, Iterable<ContentStream> ite, SimpleOrderedMap<Object> results)
        throws Exception {
  FeaturesConfigReader fcReader = new FeaturesConfigReader(req.getCore().getResourceLoader(),
          req.getParams().required().get("conf"));
  FeaturesConfigReader.FeatureDesc[] featureDescs = fcReader.getFeatureDescs();
  List<FieldFeatureExtractorFactory> featuresSpec = new ArrayList<FieldFeatureExtractorFactory>();
  for(FeaturesConfigReader.FeatureDesc featureDesc: featureDescs){
    FieldFeatureExtractorFactory dfeFactory = FeaturesConfigReader.loadFactory(featureDesc);
    featuresSpec.add(dfeFactory);
  }
  StringBuilder queries = new StringBuilder();
  for(ContentStream cs: ite){
    Reader reader = cs.getReader();
    try{
      queries.append(IOUtils.toString(reader));
    }
    finally{
      IOUtils.closeQuietly(reader);
    }
  }
  long procId = startExtractor(req, featuresSpec, queries.toString());
  FeaturesExtractorManager manager = getManager(procId);
  results.add("procId", procId);
  results.add("progress", manager.getProgress());
}
 
开发者ID:NLP4L,项目名称:solr,代码行数:26,代码来源:FeaturesRequestHandler.java

示例3: toNamedList

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
/** Convert this to a NamedList */
public NamedList<Object> toNamedList() {
  final SimpleOrderedMap<Object> result = new SimpleOrderedMap<>();
  
  for(Iterator<String> it=getParameterNamesIterator(); it.hasNext(); ) {
    final String name = it.next();
    final String [] values = getParams(name);
    if(values.length==1) {
      result.add(name,values[0]);
    } else {
      // currently no reason not to use the same array
      result.add(name,values);
    }
  }
  return result;
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:SolrParams.java

示例4: getIndexInfo

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
public static SimpleOrderedMap<Object> getIndexInfo(DirectoryReader reader) throws IOException {
  Directory dir = reader.directory();
  SimpleOrderedMap<Object> indexInfo = new SimpleOrderedMap<>();

  indexInfo.add("numDocs", reader.numDocs());
  indexInfo.add("maxDoc", reader.maxDoc());
  indexInfo.add("deletedDocs", reader.maxDoc() - reader.numDocs());
  indexInfo.add("indexHeapUsageBytes", getIndexHeapUsed(reader));

  indexInfo.add("version", reader.getVersion());  // TODO? Is this different then: IndexReader.getCurrentVersion( dir )?
  indexInfo.add("segmentCount", reader.leaves().size());
  indexInfo.add("current", reader.isCurrent() );
  indexInfo.add("hasDeletions", reader.hasDeletions() );
  indexInfo.add("directory", dir );
  indexInfo.add("userData", reader.getIndexCommit().getUserData());
  String s = reader.getIndexCommit().getUserData().get(SolrIndexWriter.COMMIT_TIME_MSEC_KEY);
  if (s != null) {
    indexInfo.add("lastModified", new Date(Long.parseLong(s)));
  }
  return indexInfo;
}
 
开发者ID:europeana,项目名称:search,代码行数:22,代码来源:LukeRequestHandler.java

示例5: emptyResponse

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
/**
 * Returns a Null Object response, indicating no handler produced a match.
 * 
 * @param request the current {@link SolrQueryRequest}.
 * @param response the current {@link SolrQueryResponse}.
 * @return a Null Object response, indicating no handler produced a match.
 */
NamedList<Object> emptyResponse(final SolrQueryRequest request, final SolrQueryResponse response) {
	final SimpleOrderedMap<Object> empty = new SimpleOrderedMap<>();
	empty.add(RESPONSE_KEY, 
			new BasicResultContext(
				EMPTY_DOCLIST, 
				response.getReturnFields(),
				request.getSearcher(),
				null,
				request));
	
	empty.add(RESPONSE_HEADER_KEY, new SimpleOrderedMap<>());
	return empty;
}
 
开发者ID:spaziocodice,项目名称:invisible-queries-request-handler,代码行数:21,代码来源:InvisibleQueriesRequestHandler.java

示例6: parseQ

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
SimpleOrderedMap<Object> parseQ(Config q){
  SimpleOrderedMap<Object> result = new SimpleOrderedMap<Object>();
  result.add("qid", q.getInt("qid"));
  result.add("query", q.getString("query"));
  result.add("docs", parseDocs(q.getConfigList("docs")));
  return result;
}
 
开发者ID:NLP4L,项目名称:solr,代码行数:8,代码来源:FeaturesExtractorManager.java

示例7: handleProgress

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
public void handleProgress(SolrQueryRequest req, SimpleOrderedMap<Object> results) throws Exception {
  long procId = req.getParams().required().getLong("procId");
  FeaturesExtractorManager manager = getManager(procId);
  results.add("procId", procId);
  results.add("done?", manager.isDone());
  results.add("progress", manager.getProgress());
}
 
开发者ID:NLP4L,项目名称:solr,代码行数:8,代码来源:FeaturesRequestHandler.java

示例8: getFacetIntervalCounts

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
/**
 * Returns a <code>NamedList</code> with each entry having the "key" of the interval as name and the count of docs 
 * in that interval as value. All intervals added in the request are included in the returned 
 * <code>NamedList</code> (included those with 0 count), and it's required that the order of the intervals
 * is deterministic and equals in all shards of a distributed request, otherwise the collation of results
 * will fail. 
 * 
 */
public NamedList<Object> getFacetIntervalCounts() throws IOException, SyntaxError {
  NamedList<Object> res = new SimpleOrderedMap<Object>();
  String[] fields = global.getParams(FacetParams.FACET_INTERVAL);
  if (fields == null || fields.length == 0) return res;

  for (String field : fields) {
    final ParsedParams parsed = parseParams(FacetParams.FACET_INTERVAL, field);
    String[] intervalStrs = parsed.required.getFieldParams(parsed.facetValue, FacetParams.FACET_INTERVAL_SET);
    SchemaField schemaField = searcher.getCore().getLatestSchema().getField(parsed.facetValue);
    if (parsed.params.getBool(GroupParams.GROUP_FACET, false)) {
      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Interval Faceting can't be used with " + GroupParams.GROUP_FACET);
    }
    if (schemaField.getType().isPointField() && !schemaField.hasDocValues()) {
      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Can't use interval faceting on a PointField without docValues");
    }
    
    SimpleOrderedMap<Integer> fieldResults = new SimpleOrderedMap<Integer>();
    res.add(parsed.key, fieldResults);
    IntervalFacets intervalFacets = new IntervalFacets(schemaField, searcher, parsed.docs, intervalStrs, parsed.params);
    for (FacetInterval interval : intervalFacets) {
      fieldResults.add(interval.getKey(), interval.getCount());
    }
  }

  return res;
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:35,代码来源:SimpleFacets.java

示例9: mapContainsValue

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
@Test
public void mapContainsValue()
{
    SimpleOrderedMap<String> map = new SimpleOrderedMap<>();
    map.add("id", "123");
    map.add("name", "testName");

    Assert.assertTrue(MapUtility.mapContainsValue("123", map));
    Assert.assertFalse(MapUtility.mapContainsValue("12", map));
    Assert.assertTrue(MapUtility.mapContainsValue("testName", map));
    Assert.assertFalse(MapUtility.mapContainsValue("test", map));
}
 
开发者ID:careerbuilder,项目名称:semantic-knowledge-graph,代码行数:13,代码来源:MapUtilityTest.java

示例10: addGeneratedValues

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
@Test
public void addGeneratedValues() throws IOException
{
    ResponseNode response = new ResponseNode("testField");
    response.values = new ResponseValue[2];

    runner.buckets = new LinkedList<>();
    SimpleOrderedMap<Object> generatedValue1 = new SimpleOrderedMap<>();
    generatedValue1.add("val", "generatedValue1");
    SimpleOrderedMap<Object> generatedValue2 = new SimpleOrderedMap<>();
    generatedValue2.add("val", "generatedValue2");
    runner.buckets.add(generatedValue1);
    runner.buckets.add(generatedValue2);
    ResponseValue [] expecteds = new ResponseValue[2];
    expecteds[0] = new ResponseValue("generatedValue1");
    expecteds[0].normalizedValue = new SimpleOrderedMap<>();
    expecteds[0].normalizedValue.add("name", "generatedValue1");
    expecteds[1] = new ResponseValue("generatedValue2");
    expecteds[1].normalizedValue = new SimpleOrderedMap<>();
    expecteds[1].normalizedValue.add("name", "generatedValue2");

    NodeGenerator target = new NodeGenerator();
    Deencapsulation.invoke(target, "addGeneratedValues", response, runner, 0);

    Assert.assertEquals(2, response.values.length);
    for(int i = 0; i < expecteds.length; ++i) {
        Assert.assertTrue(response.values[i].equals(expecteds[i]));
        Assert.assertTrue(MapUtility.mapsEqual(response.values[i].normalizedValue, expecteds[i].normalizedValue));
    }
}
 
开发者ID:careerbuilder,项目名称:semantic-knowledge-graph,代码行数:31,代码来源:NodeGeneratorTest.java

示例11: mapsEqual_NotEqual

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
@Test public void mapsEqual_NotEqual() {
    SimpleOrderedMap<String> map1 = new SimpleOrderedMap<>();
    map1.add("id", "123");
    map1.add("name", "testName");
    SimpleOrderedMap<String> map2 = new SimpleOrderedMap<>();
    map2.add("id", "321");
    map2.add("name", "testName");
    SimpleOrderedMap<String> emptyMap = new SimpleOrderedMap<>();

    Assert.assertFalse(MapUtility.mapsEqual(map1, map2));
    Assert.assertFalse(MapUtility.mapsEqual(null, map2));
    Assert.assertFalse(MapUtility.mapsEqual(map1, null));
    Assert.assertFalse(MapUtility.mapsEqual(map1, emptyMap));
    Assert.assertFalse(MapUtility.mapsEqual(emptyMap, map2));
}
 
开发者ID:careerbuilder,项目名称:semantic-knowledge-graph,代码行数:16,代码来源:MapUtilityTest.java

示例12: getMapValue_Title

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
@Test
public void getMapValue_Title() throws IOException
{
    NodeContext context = new NodeContext(new ParameterSet(null,null,invariants));
    FacetFieldAdapter target = new FacetFieldAdapter(context, "title");

    SimpleOrderedMap<Object> resultBucket = new SimpleOrderedMap<>();
    resultBucket.add("val", "99^testtitle");
    SimpleOrderedMap<String> actual = target.getMapValue(resultBucket);

    Assert.assertEquals("99", actual.get("id"));
    Assert.assertEquals("testtitle", actual.get("title"));
}
 
开发者ID:careerbuilder,项目名称:semantic-knowledge-graph,代码行数:14,代码来源:FacetFieldAdapterTest.java

示例13: getStringValue_Title

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
@Test
public void getStringValue_Title() throws IOException
{
    NodeContext context = new NodeContext(new ParameterSet(null,null,invariants));
    FacetFieldAdapter target = new FacetFieldAdapter(context, "title");

    SimpleOrderedMap<Object> resultBucket = new SimpleOrderedMap<>();
    resultBucket.add("val", "99^testtitle");
    String actual = target.getStringValue(resultBucket);

    Assert.assertEquals("99", actual);
}
 
开发者ID:careerbuilder,项目名称:semantic-knowledge-graph,代码行数:13,代码来源:FacetFieldAdapterTest.java

示例14: getMapValue_Tags

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
@Test
public void getMapValue_Tags() throws IOException
{
    NodeContext context = new NodeContext(new ParameterSet(null,null,invariants));
    FacetFieldAdapter target = new FacetFieldAdapter(context, "tags");

    SimpleOrderedMap<Object> resultBucket = new SimpleOrderedMap<>();
    resultBucket.add("val", "99^testtitle");
    SimpleOrderedMap<String> actual = target.getMapValue(resultBucket);

    Assert.assertEquals("99", actual.get("id"));
    Assert.assertEquals("testtitle", actual.get("title"));
}
 
开发者ID:careerbuilder,项目名称:semantic-knowledge-graph,代码行数:14,代码来源:FacetFieldAdapterTest.java

示例15: getStringValue_Tags

import org.apache.solr.common.util.SimpleOrderedMap; //导入方法依赖的package包/类
@Test
public void getStringValue_Tags() throws IOException
{
    NodeContext context = new NodeContext(new ParameterSet(null,null,invariants));
    FacetFieldAdapter target = new FacetFieldAdapter(context, "tags");

    SimpleOrderedMap<Object> resultBucket = new SimpleOrderedMap<>();
    resultBucket.add("val", "99^testtitle");
    String actual = target.getStringValue(resultBucket);

    Assert.assertEquals("99", actual);
}
 
开发者ID:careerbuilder,项目名称:semantic-knowledge-graph,代码行数:13,代码来源:FacetFieldAdapterTest.java


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