org.hibernate.search.bridge.LuceneOptions Java Examples
The following examples show how to use
org.hibernate.search.bridge.LuceneOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HibernateSearchUsersGroupsBridge.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
/** * 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); }
Example #2
Source File: HibernateSearchTaskPathBridge.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
/** * 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); } }
Example #3
Source File: MapFieldBridge.java From document-management-system with GNU General Public License v2.0 | 6 votes |
@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>"); } }
Example #4
Source File: HibernateSearchUsersBridge.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
/** * 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); }
Example #5
Source File: CustomFieldValuesBridge.java From wallride with Apache License 2.0 | 5 votes |
@Override public void set(String name, Object value, Document document, LuceneOptions luceneOptions) { Collection<CustomFieldValue> customFieldValues = (Collection<CustomFieldValue>) value; if (customFieldValues != null) { for (CustomFieldValue cfv : customFieldValues) { if (cfv.getValue() != null) { luceneOptions.addFieldToDocument(name + "." + cfv.getCustomField().getCode(), cfv.getValue().toString(), document); } } } }
Example #6
Source File: HibernateSearchProjectKostBridge.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @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 ProjektDO projekt = (ProjektDO) value; final StringBuffer buf = new StringBuffer(); buf.append(KostFormatter.format(projekt)); buf.append(' '); buf.append(KostFormatter.format(projekt, true)); luceneOptions.addFieldToDocument(name, buf.toString(), document); }
Example #7
Source File: HibernateSearchKost1Bridge.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @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 Kost1DO kost1 = (Kost1DO) value; final StringBuffer buf = new StringBuffer(); buf.append(KostFormatter.format(kost1)); buf.append(' '); buf.append(KostFormatter.format(kost1, true)); luceneOptions.addFieldToDocument(name, buf.toString(), document); }
Example #8
Source File: HibernateSearchKost2Bridge.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @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 Kost2DO kost2 = (Kost2DO) value; final StringBuffer buf = new StringBuffer(); buf.append(KostFormatter.format(kost2)); buf.append(' '); buf.append(KostFormatter.format(kost2, true)); luceneOptions.addFieldToDocument(name, buf.toString(), document); }
Example #9
Source File: HibernateSearchAuftragsPositionBridge.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @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 AuftragsPositionDO position = (AuftragsPositionDO) value; final AuftragDO auftrag = position.getAuftrag(); final StringBuffer buf = new StringBuffer(); if (auftrag == null || auftrag.getNummer() == null) { return; } buf.append(auftrag.getNummer()).append(".").append(position.getNumber()); if (log.isDebugEnabled() == true) { log.debug(buf.toString()); } luceneOptions.addFieldToDocument(name, buf.toString(), document); }
Example #10
Source File: LowerCaseFieldBridge.java From document-management-system with GNU General Public License v2.0 | 5 votes |
@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"); } }
Example #11
Source File: WebDSLDynamicFieldBridge.java From webdsl with Apache License 2.0 | 5 votes |
@Override public void set( String name, Object value, Document document, LuceneOptions luceneOptions) { for(DynamicSearchField dsf : ( (DynamicSearchFields) value).getDynamicSearchFields_()){ document.add( new Field( dsf.fieldName, dsf.fieldValue, Store.NO, Index.NOT_ANALYZED, luceneOptions.getTermVector() ) ); } }
Example #12
Source File: TagsBridge.java From hawkular-alerts with Apache License 2.0 | 5 votes |
@Override public void set(String name, Object value, Document document, LuceneOptions luceneOptions) { Map<String, String> tags = (Map<String, String>)value; for (Map.Entry<String, String> tag : tags.entrySet()) { bridge.set(name, tag, document, luceneOptions); } }
Example #13
Source File: LazyFieldBridge.java From document-management-system with GNU General Public License v2.0 | 5 votes |
@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"); } }
Example #14
Source File: UUIDFieldBridge.java From webdsl with Apache License 2.0 | 4 votes |
public void set(String name, Object value, Document doc, LuceneOptions options) { Field field = new Field(name, value.toString(), options.getStore(), options.getIndex(), options.getTermVector()); field.setBoost(options.getBoost()); doc.add(field); }
Example #15
Source File: TagsBridge.java From hawkular-alerts with Apache License 2.0 | 4 votes |
@Override public void set(String name, Object value, Document document, LuceneOptions luceneOptions) { luceneOptions.addFieldToDocument(name, objectToString(value), document); }
Example #16
Source File: HibernateSearchUserRightIdBridge.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
/** * @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 UserRightId userRightId = (UserRightId) value; luceneOptions.addFieldToDocument(name, userRightId.getId(), document); }
Example #17
Source File: LazyField.java From document-management-system with GNU General Public License v2.0 | 4 votes |
public LazyField(String name, PersistentFile persistentFile, LuceneOptions luceneOptions) { super(name, luceneOptions.getStore(), luceneOptions.getIndex(), luceneOptions.getTermVector()); lazy = true; this.persistentFile = persistentFile; }
Example #18
Source File: ProductClassBridgeIT.java From development with Apache License 2.0 | 2 votes |
private LuceneOptions mockLuceneOptions() { return null; }