• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FieldFlag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: populate

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
@Override
protected void populate() throws SophieException {
    // Get remote fields + unique key.
    String uniqueField = SolrUtils.getRemoteUniqueField();
    List<FieldInfo> fields = SolrUtils.getRemoteFields();

    // Populate table.
    for (FieldInfo field : fields) {
        Map<String, String> values = new HashMap<String, String>();
        values.put("Name", field.getName());
        values.put("Type", field.getType());
        values.put("Unique", Boolean.toString(StringUtils.equals(field.getName(), uniqueField)));
        values.put("Distinct", Integer.toString(field.getDistinct()));
        values.put("Schema", field.getSchema());
        for (FieldFlag flag : FieldFlag.values()) {
            EnumSet<FieldFlag> flags = SolrUtils.getFlags(field);
            values.put(flag.getDisplay(), Boolean.toString(flags.contains(flag)));
        }
        addRow(values);
    }
}
 
开发者ID:fengtan,项目名称:sophie,代码行数:22,代码来源:FieldsTable.java


示例2: parseFlags

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
public static EnumSet<FieldFlag> parseFlags(String flagStr) {
  EnumSet<FieldFlag> result = EnumSet.noneOf(FieldFlag.class);
  char[] chars = flagStr.toCharArray();
  for (int i = 0; i < chars.length; i++) {
    if (chars[i] != '-') {
      FieldFlag flag = FieldFlag.getFlag(chars[i]);
      result.add(flag);
    }
  }
  return result;
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:LukeResponse.java


示例3: getFieldFlags

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
/**
 * @return a string representing a IndexableField's flags.  
 */
private static String getFieldFlags( IndexableField f )
{
  IndexOptions opts = (f == null) ? null : f.fieldType().indexOptions();

  StringBuilder flags = new StringBuilder();

  flags.append( (f != null && f.fieldType().indexed())                     ? FieldFlag.INDEXED.getAbbreviation() : '-' );
  flags.append( (f != null && f.fieldType().tokenized())                   ? FieldFlag.TOKENIZED.getAbbreviation() : '-' );
  flags.append( (f != null && f.fieldType().stored())                      ? FieldFlag.STORED.getAbbreviation() : '-' );
  flags.append( (f != null && f.fieldType().docValueType() != null)        ? FieldFlag.DOC_VALUES.getAbbreviation() : "-" );
  flags.append( (false)                                          ? FieldFlag.MULTI_VALUED.getAbbreviation() : '-' ); // SchemaField Specific
  flags.append( (f != null && f.fieldType().storeTermVectors())            ? FieldFlag.TERM_VECTOR_STORED.getAbbreviation() : '-' );
  flags.append( (f != null && f.fieldType().storeTermVectorOffsets())   ? FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation() : '-' );
  flags.append( (f != null && f.fieldType().storeTermVectorPositions()) ? FieldFlag.TERM_VECTOR_POSITION.getAbbreviation() : '-' );
  flags.append( (f != null && f.fieldType().omitNorms())                  ? FieldFlag.OMIT_NORMS.getAbbreviation() : '-' );

  flags.append( (f != null && DOCS_ONLY == opts ) ?
      FieldFlag.OMIT_TF.getAbbreviation() : '-' );

  flags.append((f != null && DOCS_AND_FREQS == opts) ?
      FieldFlag.OMIT_POSITIONS.getAbbreviation() : '-');
  
  flags.append((f != null && DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS == opts) ?
      FieldFlag.STORE_OFFSETS_WITH_POSITIONS.getAbbreviation() : '-');

  flags.append( (f != null && f.getClass().getSimpleName().equals("LazyField")) ? FieldFlag.LAZY.getAbbreviation() : '-' );
  flags.append( (f != null && f.binaryValue()!=null)                      ? FieldFlag.BINARY.getAbbreviation() : '-' );
  flags.append( (false)                                          ? FieldFlag.SORT_MISSING_FIRST.getAbbreviation() : '-' ); // SchemaField Specific
  flags.append( (false)                                          ? FieldFlag.SORT_MISSING_LAST.getAbbreviation() : '-' ); // SchemaField Specific
  return flags.toString();
}
 
开发者ID:europeana,项目名称:search,代码行数:35,代码来源:LukeRequestHandler.java


示例4: getFieldFlagsKey

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
/**
 * @return a key to what each character means
 */
public static SimpleOrderedMap<String> getFieldFlagsKey() {
  SimpleOrderedMap<String> key = new SimpleOrderedMap<>();
  for (FieldFlag f : FieldFlag.values()) {
    key.add(String.valueOf(f.getAbbreviation()), f.getDisplay() );
  }
  return key;
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:LukeRequestHandler.java


示例5: buildField

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
private FieldInfo buildField(String name, String type, EnumSet<FieldFlag> flags) {
	FieldInfo info = Mockito.mock(FieldInfo.class);
	Mockito.stub(info.getName()).toReturn(name);
	Mockito.stub(info.getType()).toReturn(type);
	Mockito.stub(info.getFlags()).toReturn(flags);
	return info;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:8,代码来源:TestSolrMetadataProcessor.java


示例6: testMetadata

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
@Test
public void testMetadata() throws TranslatorException {
    SolrMetadataProcessor mp = new SolrMetadataProcessor();
    
    MetadataFactory mf = new MetadataFactory("vdb", 1, "solr", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
    SolrConnection conn = Mockito.mock(SolrConnection.class);
    Mockito.stub(conn.getCoreName()).toReturn("SomeTable");
    
    
    LinkedHashMap<String, FieldInfo> fields = new LinkedHashMap<String, LukeResponse.FieldInfo>();
    fields.put("col1", buildField("col1", "string", EnumSet.of(FieldFlag.STORED, FieldFlag.INDEXED)));
    fields.put("col2", buildField("col2", "int", EnumSet.of(FieldFlag.STORED, FieldFlag.INDEXED)));
    fields.put("col3", buildField("col3", "int", EnumSet.of(FieldFlag.STORED, FieldFlag.INDEXED, FieldFlag.MULTI_VALUED)));
    fields.put("id", buildField("id", "long", EnumSet.of(FieldFlag.STORED, FieldFlag.INDEXED)));
    
    LukeResponse response = Mockito.mock(LukeResponse.class);;
    Mockito.stub(response.getFieldInfo()).toReturn(fields);
    
    Mockito.stub(conn.metadata(Mockito.any(LukeRequest.class))).toReturn(response);
    
    mp.process(mf, conn);

    String metadataDDL = DDLStringVisitor.getDDLString(mf.getSchema(), null, null);
    String expected = "CREATE FOREIGN TABLE SomeTable (\n" + 
    		"	col1 string OPTIONS (SEARCHABLE 'Searchable'),\n" + 
    		"	col2 integer OPTIONS (SEARCHABLE 'Searchable'),\n" + 
    		"	col3 integer[] OPTIONS (SEARCHABLE 'Searchable'),\n" + 
    		"	id long OPTIONS (SEARCHABLE 'Searchable'),\n" + 
    		"	CONSTRAINT PK0 PRIMARY KEY(id)\n" + 
    		") OPTIONS (UPDATABLE TRUE);";
    assertEquals(expected, metadataDDL);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:33,代码来源:TestSolrMetadataProcessor.java


示例7: getRemoteFacets

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
/**
 * Get a list of remote facets keyed by field name.
 * 
 * @param fields
 *            Fields.
 * @return List of facets keyed by field name.
 * @throws SophieException
 *             If facets could not be fetched.
 */
private Map<String, FacetField> getRemoteFacets(List<FieldInfo> fields) throws SophieException {
    // Prepare query.
    SolrQuery query = getBaseQuery(0, 0);
    query.setFacet(true);
    query.setFacetSort("index");
    query.setFacetLimit(FACET_LIMIT);
    query.setFacetMissing(true);

    // For each field, determine whether Solr can generate a facet (fq works
    // only on indexed fields). If yes, then list that field in the query.
    for (FieldInfo field : fields) {
        if (SolrUtils.getFlags(field).contains(FieldFlag.INDEXED)) {
            query.addFacetField(field.getName());
        }
    }

    // Send query.
    Map<String, FacetField> facets = new HashMap<String, FacetField>();
    try {
        for (FacetField facet : Sophie.client.query(query).getFacetFields()) {
            facets.put(facet.getName(), facet);
        }
    } catch (SolrServerException | IOException | SolrException e) {
        throw new SophieException("Unable to fetch remote facets", e);
    }

    // Return facets keyed by field name.
    return facets;
}
 
开发者ID:fengtan,项目名称:sophie,代码行数:39,代码来源:DocumentsTable.java


示例8: FieldsTable

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
/**
 * Create a new table listing Solr fields.
 * 
 * @param composite
 *            Parent composite.
 * @throws SophieException
 *             If the table could not be initialized.
 */
public FieldsTable(Composite composite) throws SophieException {
    super(composite);

    // Add columns (static + flags).
    for (String columnName : columnNames) {
        addColumn(columnName);
    }
    for (FieldFlag flag : FieldFlag.values()) {
        addColumn(flag.getDisplay());
    }

    // Add rows.
    populate();
}
 
开发者ID:fengtan,项目名称:sophie,代码行数:23,代码来源:FieldsTable.java


示例9: isFieldSortable

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
/**
 * Whether Solr can sort a field.
 * 
 * @param field
 *            Field.
 * @return True if Solr can sort the field, false otherwise.
 */
public static boolean isFieldSortable(FieldInfo field) {
    // A field is sortable if
    // 1) it is indexed
    // 2) it is not multivalued
    // 3) it does not have docValues
    EnumSet<FieldFlag> flags = SolrUtils.getFlags(field);
    return (flags.contains(FieldFlag.INDEXED) && !flags.contains(FieldFlag.DOC_VALUES) && !flags.contains(FieldFlag.MULTI_VALUED));
}
 
开发者ID:fengtan,项目名称:sophie,代码行数:16,代码来源:SolrUtils.java


示例10: getFieldFlags

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
/**
 * @return a string representing a IndexableField's flags.
 */
private static String getFieldFlags(IndexableField f)
{
    IndexOptions opts = (f == null) ? null : f.fieldType().indexOptions();

    StringBuilder flags = new StringBuilder();

    flags.append((f != null && f.fieldType().indexed()) ? FieldFlag.INDEXED.getAbbreviation() : '-');
    flags.append((f != null && f.fieldType().tokenized()) ? FieldFlag.TOKENIZED.getAbbreviation() : '-');
    flags.append((f != null && f.fieldType().stored()) ? FieldFlag.STORED.getAbbreviation() : '-');
    flags.append((f != null && f.fieldType().docValueType() != null) ? FieldFlag.DOC_VALUES.getAbbreviation() : "-");
    flags.append((false) ? FieldFlag.MULTI_VALUED.getAbbreviation() : '-'); // SchemaField Specific
    flags.append((f != null && f.fieldType().storeTermVectors()) ? FieldFlag.TERM_VECTOR_STORED.getAbbreviation() : '-');
    flags.append((f != null && f.fieldType().storeTermVectorOffsets()) ? FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation() : '-');
    flags.append((f != null && f.fieldType().storeTermVectorPositions()) ? FieldFlag.TERM_VECTOR_POSITION.getAbbreviation() : '-');
    flags.append((f != null && f.fieldType().omitNorms()) ? FieldFlag.OMIT_NORMS.getAbbreviation() : '-');

    flags.append((f != null && DOCS_ONLY == opts) ? FieldFlag.OMIT_TF.getAbbreviation() : '-');

    flags.append((f != null && DOCS_AND_FREQS == opts) ? FieldFlag.OMIT_POSITIONS.getAbbreviation() : '-');

    flags.append((f != null && DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS == opts) ? FieldFlag.STORE_OFFSETS_WITH_POSITIONS.getAbbreviation() : '-');

    flags.append((f != null && f.getClass().getSimpleName().equals("LazyField")) ? FieldFlag.LAZY.getAbbreviation() : '-');
    flags.append((f != null && f.binaryValue() != null) ? FieldFlag.BINARY.getAbbreviation() : '-');
    flags.append((false) ? FieldFlag.SORT_MISSING_FIRST.getAbbreviation() : '-'); // SchemaField Specific
    flags.append((false) ? FieldFlag.SORT_MISSING_LAST.getAbbreviation() : '-'); // SchemaField Specific
    return flags.toString();
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:32,代码来源:AlfrescoLukeRequestHandler.java


示例11: getFieldFlagsKey

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
/**
 * @return a key to what each character means
 */
public static SimpleOrderedMap<String> getFieldFlagsKey()
{
    SimpleOrderedMap<String> key = new SimpleOrderedMap<>();
    for (FieldFlag f : FieldFlag.values())
    {
        key.add(String.valueOf(f.getAbbreviation()), f.getDisplay());
    }
    return key;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:13,代码来源:AlfrescoLukeRequestHandler.java


示例12: getFieldFlagsKey

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
/**
 * @return a key to what each character means
 */
public static SimpleOrderedMap<String> getFieldFlagsKey() {
  SimpleOrderedMap<String> key = new SimpleOrderedMap<String>();
  for (FieldFlag f : FieldFlag.values()) {
    key.add(String.valueOf(f.getAbbreviation()), f.getDisplay() );
  }
  return key;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:11,代码来源:LukeRequestHandler.java


示例13: getFlags

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
public EnumSet<FieldFlag> getFlags() {
  return flags;
}
 
开发者ID:europeana,项目名称:search,代码行数:4,代码来源:LukeResponse.java


示例14: getConnectorMetadata

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
public void getConnectorMetadata(SolrConnection conn, MetadataFactory metadataFactory) throws TranslatorException {
	int count = 0;
	LukeRequest request = new LukeRequest();
	request.setShowSchema(true);
	LukeResponse response = conn.metadata(request);
	
	Map<String, FieldInfo> fields = response.getFieldInfo();
	
	Table table = metadataFactory.addTable(conn.getCoreName());
	table.setSupportsUpdate(true);
	
	for (String name:fields.keySet()) {
		FieldInfo field = fields.get(name);
		EnumSet<FieldFlag> flags = field.getFlags();
		if ((!name.startsWith("_") && !name.endsWith("_")) || name.startsWith("*") || name.endsWith("*")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
			if (flags.contains(FieldFlag.INDEXED) && flags.contains(FieldFlag.STORED)) {
				Column column = null;
				// array type
				if (flags.contains(FieldFlag.MULTI_VALUED)) {
					column = metadataFactory.addColumn(field.getName(), resolveType(field.getType())+"[]", table); //$NON-NLS-1$
				}
				else {
					column = metadataFactory.addColumn(field.getName(), resolveType(field.getType()), table);	
				}
				column.setUpdatable(true);
				column.setSearchType(SearchType.Searchable);
					
				// create primary key; and unique keys
				if (field.getDistinct() > 0 || field.getName().equals("id")) { //$NON-NLS-1$
					if (table.getPrimaryKey() == null) {
						metadataFactory.addPrimaryKey("PK0", Arrays.asList(field.getName()), table); //$NON-NLS-1$
					}
					else {
						metadataFactory.addIndex("UI"+count, true, Arrays.asList(field.getName()), table); //$NON-NLS-1$
						count++;
					}
				}
			}
		}
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:42,代码来源:SolrMetadataProcessor.java


示例15: getFlags

import org.apache.solr.common.luke.FieldFlag; //导入依赖的package包/类
/**
 * Extract flags from a Solr field.
 *
 * Because of a bug in SolrJ, FieldInfo.getFlags() may return null if the
 * request was made by calling LukeRequest.setSchema(false). This method
 * extracts the flags in all cases.
 * 
 * @param field
 *            Solr field.
 * @return List of flags.
 */
public static EnumSet<FieldFlag> getFlags(FieldInfo field) {
    // TODO Remove when SOLR-9205 is closed.
    EnumSet<FieldFlag> flags = field.getFlags();
    if (flags == null) {
        flags = FieldInfo.parseFlags(field.getSchema());
    }
    return flags;
}
 
开发者ID:fengtan,项目名称:sophie,代码行数:20,代码来源:SolrUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RuntimeTypeInfo类代码示例发布时间:2022-05-23
下一篇:
Java NeutronApi类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap