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


Java LuceneOptions类代码示例

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


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

示例1: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
	if (value instanceof Map<?, ?>) {
		@SuppressWarnings("unchecked")
		Map<String, Integer> map = (Map<String, Integer>) value;

		for (Entry<String, Integer> elto : map.entrySet()) {
			if ((Permission.READ & elto.getValue()) != 0) {
				if ("userPermissions".equals(name)) {
					name = "userPermission";
				} else if ("rolePermissions".equals(name)) {
					name = "rolePermission";
				}

				log.debug("Added field '{}' with value '{}'", name, elto.getKey());
				luceneOptions.addFieldToDocument(name, elto.getKey(), document);
			}
		}
	} else {
		log.warn("IllegalArgumentException: Support only Map<String, Integer>");
		throw new IllegalArgumentException("Support only Map<String, Integer>");
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:24,代码来源:MapFieldBridge.java

示例2: newField

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
private Field newField(String name, String value, LuceneOptions luceneOptions,Analyzer analyzer)
{
    Field f =new Field(name,value,
            luceneOptions.getStore(),
            luceneOptions.getIndex(),
            luceneOptions.getTermVector()
    );
    
    f.setBoost(luceneOptions.getBoost());
    
    if(analyzer != null)
    {
        f.setTokenStream(analyzer.tokenStream(name, new StringReader(value)));
    }
    
    return f;
}
 
开发者ID:michal-ruzicka,项目名称:MathMLCanEval,代码行数:18,代码来源:CanonicOutputBridge.java

示例3: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
/**
 * Get all full names and user names of all users represented by the string of user id's.
 * @see org.hibernate.search.bridge.FieldBridge#set(java.lang.String, java.lang.Object, org.apache.lucene.document.Document,
 *      org.hibernate.search.bridge.LuceneOptions)
 */
public void set(final String name, final Object value, final Document document, final LuceneOptions luceneOptions)
{
  final LicenseDO license = (LicenseDO)value;
  if (StringUtils.isBlank(license.getOwnerIds()) == true) {
    return;
  }
  final UsersProvider usersProvider = new UsersProvider();
  final Collection<PFUserDO> users = usersProvider.getSortedUsers(license.getOwnerIds());
  final StringBuffer buf = new StringBuffer();
  boolean first = true;
  for (final PFUserDO user : users) {
    first = StringHelper.append(buf, first, user.getFullname(), " ");
    buf.append(" ").append(user.getUsername());
  }
  luceneOptions.addFieldToDocument(name, buf.toString(), document);
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:22,代码来源:HibernateSearchUsersBridge.java

示例4: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
/**
 * Get all names of ancestor tasks and task itself and creates an index containing all task titles separated by '|'. <br/>
 * Please note: does not work in JUnit test mode.
 * @see org.hibernate.search.bridge.FieldBridge#set(java.lang.String, java.lang.Object, org.apache.lucene.document.Document,
 *      org.hibernate.search.bridge.LuceneOptions)
 */
public void set(final String name, final Object value, final Document document, final LuceneOptions luceneOptions)
{
  final TaskDO task = (TaskDO) value;
  if (SpringContext.getWebApplicationContext() != null) { // Is null in test environment.
    final TaskTree taskTree = SpringContext.getBean(TaskTree.class);
    final TaskNode taskNode = taskTree.getTaskNodeById(task.getId());
    if (taskNode == null) {
      return;
    }
    final List<TaskNode> list = taskNode.getPathToRoot();
    final StringBuffer buf = new StringBuffer();
    for (final TaskNode node : list) {
      buf.append(node.getTask().getTitle()).append("|");
    }
    if (log.isDebugEnabled() == true) {
      log.debug(buf.toString());
    }
    luceneOptions.addFieldToDocument(name, buf.toString(), document);
  }
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:27,代码来源:HibernateSearchTaskPathBridge.java

示例5: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
/**
 * Get all names of groups and users and creates an index containing all user and group names separated by '|'. <br/>
 * @see org.hibernate.search.bridge.FieldBridge#set(java.lang.String, java.lang.Object, org.apache.lucene.document.Document,
 *      org.hibernate.search.bridge.LuceneOptions)
 */
public void set(final String name, final Object value, final Document document, final LuceneOptions luceneOptions)
{
  final TeamCalDO calendar = (TeamCalDO) value;
  final TeamCalDao teamCalDao = Registry.instance().getDao(TeamCalDao.class);
  if (teamCalDao == null) {
    if (Configuration.getInstance().isTestMode() == false) {
      log.error("TeamCalDao not found in registry!");
    }
    return;
  }
  final StringBuffer buf = new StringBuffer();
  appendGroups(teamCalDao.getSortedFullAccessGroups(calendar), buf);
  appendGroups(teamCalDao.getSortedReadonlyAccessGroups(calendar), buf);
  appendGroups(teamCalDao.getSortedMinimalAccessGroups(calendar), buf);
  appendUsers(teamCalDao.getSortedFullAccessUsers(calendar), buf);
  appendUsers(teamCalDao.getSortedReadonlyAccessUsers(calendar), buf);
  appendUsers(teamCalDao.getSortedMinimalAccessUsers(calendar), buf);
  if (log.isDebugEnabled() == true) {
    log.debug(buf.toString());
  }
  luceneOptions.addFieldToDocument(name, buf.toString(), document);
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:28,代码来源:HibernateSearchUsersGroupsBridge.java

示例6: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
    if (!(value instanceof JsonValueWrapper)) {
        throw new IllegalArgumentException("This FieldBridge can only be applied to a JsonValueWrapper");
    }
    valueWrapper = (JsonValueWrapper) value;
    json = valueWrapper.getJson();

    try {
        Map<String, Object> entryAsMap = (Map<String, Object>) mapper.readValue(json, Object.class);
        for (String field : entryAsMap.keySet()) {
            if (entryAsMap.get(field) instanceof Number) {
                log.warn("Number field recognized. Field: " + field + " value: " + entryAsMap.get(field) +
                        " Indexing of number fields will be supported in later versions.");
            } else {
                luceneOptions.addFieldToDocument(field, entryAsMap.get(field).toString(), document);
            }
        }
    } catch (Exception e) {
        log.error("EXCEPTION occurred in JsonValueWrapperFieldBridge during adding fields into Lucene Document.", e);
    }
}
 
开发者ID:tsykora,项目名称:infinispan-odata-server,代码行数:23,代码来源:JsonValueWrapperFieldBridge.java

示例7: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public final void set(final String name,
                      final Object submittedValue,
                      final Document document,
                      final LuceneOptions luceneOptions) {

    final BridgeController.Presets presets = BridgeController.builder()
            .baseName(name)
            .document(document)
            .luceneOptions(luceneOptions)
            .build().new Presets();

    save(name, submittedValue, presets);
}
 
开发者ID:mhaddon,项目名称:Sound.je,代码行数:15,代码来源:CoreBridgeDiscriminator.java

示例8: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
	if (value instanceof String) {
		String str = ((String) value).toLowerCase();
		log.debug("Added field '{}' with value '{}'", name, str);
		luceneOptions.addFieldToDocument(name, str, document);
	} else {
		log.warn("IllegalArgumentException: Support only String");
		throw new IllegalArgumentException("Support only String");
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:12,代码来源:LowerCaseFieldBridge.java

示例9: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
	if (value instanceof PersistentFile) {
		PersistentFile pf = (PersistentFile) value;
		LazyField field = new LazyField(name, pf, luceneOptions);
		document.add(field);
	} else {
		log.warn("IllegalArgumentException: Support only String");
		throw new IllegalArgumentException("Support only String");
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:12,代码来源:LazyFieldBridge.java

示例10: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
	if (value == null) {
		return;
	}
	if (!(value instanceof Collection)) {
		throw new IllegalArgumentException("This FieldBridge only supports Collection of GenericEntity properties.");
	}
	Collection<?> objects = (Collection<?>) value;
	
	for (Object object : objects) {
		luceneOptions.addNumericFieldToDocument(name, objectToLong(object), document);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:15,代码来源:GenericEntityCollectionLongIdFieldBridge.java

示例11: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
	if (value == null) {
		return;
	}
	if (!(value instanceof Collection)) {
		throw new IllegalArgumentException("This FieldBridge only supports Collection of Enum properties.");
	}
	Collection<?> objects = (Collection<?>) value;
	
	for (Object object : objects) {
		luceneOptions.addFieldToDocument(name, objectToString(object), document);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:15,代码来源:EnumCollectionFieldBridge.java

示例12: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
	if (value == null) {
		return;
	}
	if (!(value instanceof Collection)) {
		throw new IllegalArgumentException("This FieldBridge only supports Collection of String properties.");
	}
	Collection<?> objects = (Collection<?>) value;
	
	for (Object object : objects) {
		luceneOptions.addFieldToDocument(name, objectToString(object), document);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:15,代码来源:StringCollectionFieldBridge.java

示例13: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
	if (value == null) {
		return;
	}
	luceneOptions.addFieldToDocument(name, objectToString(value), document);
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:8,代码来源:GenericEntityIdFieldBridge.java

示例14: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
	if (value == null) {
		return;
	}
	luceneOptions.addNumericFieldToDocument(name, objectToLong(value), document);
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:8,代码来源:GenericEntityLongIdFieldBridge.java

示例15: set

import org.hibernate.search.bridge.LuceneOptions; //导入依赖的package包/类
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
	if (value == null) {
		return;
	}
	if (!(value instanceof Collection)) {
		throw new IllegalArgumentException("This FieldBridge only supports Collection of GenericEntity properties.");
	}
	Collection<?> objects = (Collection<?>) value;
	
	for (Object object : objects) {
		luceneOptions.addFieldToDocument(name, objectToString(object), document);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:15,代码来源:GenericEntityCollectionIdFieldBridge.java


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