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


Java CopyField类代码示例

本文整理汇总了Java中org.apache.solr.schema.CopyField的典型用法代码示例。如果您正苦于以下问题:Java CopyField类的具体用法?Java CopyField怎么用?Java CopyField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addField

import org.apache.solr.schema.CopyField; //导入依赖的package包/类
/**
 * Add the Field and value to the document with the specified boost, invoking the copyField mechanism
 * @param name The name of the field.
 * @param val The value to add
 * @param boost The boost
 *
 * @see #addField(String, String)
 * @see #addField(org.apache.solr.schema.SchemaField, String, float)
 * @see #addSingleField(org.apache.solr.schema.SchemaField, String, float)
 *
 */
public void addField(String name, String val, float boost) {
  SchemaField sfield = schema.getFieldOrNull(name);
  if (sfield != null) {
    addField(sfield,val,boost);
  }

  // Check if we should copy this field to any other fields.
  // This could happen whether it is explicit or not.
  final List<CopyField> copyFields = schema.getCopyFieldsList(name);
  if (copyFields != null) {
    for(CopyField cf : copyFields) {
      addSingleField(cf.getDestination(), cf.getLimitedValue( val ), boost);
    }
  }

  // error if this field name doesn't match anything
  if (sfield==null && (copyFields==null || copyFields.size()==0)) {
    throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"ERROR:unknown field '" + name + "'");
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:32,代码来源:DocumentBuilder.java

示例2: toListOfStringDests

import org.apache.solr.schema.CopyField; //导入依赖的package包/类
private static List<String> toListOfStringDests(List<CopyField> raw) {
  List<String> result = new ArrayList<>(raw.size());
  for (CopyField f : raw) {
    result.add(f.getDestination().getName());
  }
  return result;
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:LukeRequestHandler.java

示例3: toListOfStringDests

import org.apache.solr.schema.CopyField; //导入依赖的package包/类
private static List<String> toListOfStringDests(List<CopyField> raw)
{
    List<String> result = new ArrayList<>(raw.size());
    for (CopyField f : raw)
    {
        result.add(f.getDestination().getName());
    }
    return result;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:10,代码来源:AlfrescoLukeRequestHandler.java

示例4: toListOfStringDests

import org.apache.solr.schema.CopyField; //导入依赖的package包/类
private static List<String> toListOfStringDests(List<CopyField> raw) {
  List<String> result = new ArrayList<String>(raw.size());
  for (CopyField f : raw) {
    result.add(f.getDestination().getName());
  }
  return result;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:8,代码来源:LukeRequestHandler.java

示例5: candidateExtraction

import org.apache.solr.schema.CopyField; //导入依赖的package包/类
@Override
public Boolean candidateExtraction(SolrCore core, String jatePropertyFile)
        throws IOException, JATEException {
    SolrIndexSearcher indexSearcher = core.getSearcher().get();
    IndexWriter writerIn = null;
    try {
    	writerIn = core.getSolrCoreState().getIndexWriter(core).get();
     Map<String,List<CopyField>> copyFields = core.getLatestSchema().getCopyFieldsMap();
	
     for (int i=0; i<indexSearcher.maxDoc(); i++) {
         Document doc = indexSearcher.doc(i);
	
         SolrUtil.copyFields(copyFields, DEFAULT_BOOST_VALUE, doc);
	
         writerIn.updateDocument(new Term("id",doc.get("id")), doc);
     }
     writerIn.commit();
	
     return true;
    } finally {
    	indexSearcher.close();
    	if (writerIn != null) {
    		writerIn.close();
    	}
    	
    }
}
 
开发者ID:ziqizhang,项目名称:jate,代码行数:28,代码来源:CompositeTermRecognitionProcessor.java


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