コード例 #1
0
 public Property createProperty(
     String name,
     String value,
     ResourcePropertyMapping mapping,
     Property.Store store,
     Property.Index index)
     throws SearchEngineException {
   Property property;
   if (mapping.getReverse() == ReverseType.NO) {
     property = createProperty(name, value, store, index, mapping.getTermVector());
   } else if (mapping.getReverse() == ReverseType.READER) {
     property = createProperty(name, new ReverseStringReader(value), mapping.getTermVector());
   } else if (mapping.getReverse() == ReverseType.STRING) {
     property =
         createProperty(name, StringUtils.reverse(value), store, index, mapping.getTermVector());
   } else {
     throw new SearchEngineException("Unsupported Reverse type [" + mapping.getReverse() + "]");
   }
   property.setBoost(mapping.getBoost());
   if (mapping.isOmitNorms() != null) {
     property.setOmitNorms(mapping.isOmitNorms());
   }
   if (mapping.isOmitTf() != null) {
     property.setOmitTf(mapping.isOmitTf());
   }
   property.setBoost(mapping.getBoost());
   ((ElasticProperty) property).setPropertyMapping(mapping);
   return property;
 }
コード例 #2
0
ファイル: ResourceKey.java プロジェクト: adityavs/compass
 private int computeHashCode() {
   int result = alias.hashCode();
   for (Property id : ids) {
     result = 29 * result + id.getStringValue().hashCode();
   }
   return result;
 }
コード例 #3
0
 public Property createProperty(
     String name,
     String value,
     @SuppressWarnings("rawtypes") ResourcePropertyConverter converter) {
   Property.Store store = converter.suggestStore();
   if (store == null) {
     store = Property.Store.YES;
   }
   Property.Index index = converter.suggestIndex();
   if (index == null) {
     index = Property.Index.ANALYZED;
   }
   Property.TermVector termVector = converter.suggestTermVector();
   if (termVector == null) {
     termVector = Property.TermVector.NO;
   }
   Property property = createProperty(name, value, store, index, termVector);
   if (converter.suggestOmitNorms() != null) {
     property.setOmitNorms(converter.suggestOmitNorms());
   }
   if (converter.suggestOmitTf() != null) {
     property.setOmitTf(converter.suggestOmitTf());
   }
   return property;
 }
コード例 #4
0
ファイル: ResourceKey.java プロジェクト: adityavs/compass
 public String buildUID() throws CompassException {
   StringBuilder sb = new StringBuilder();
   sb.append(getAlias()).append(SEPARATOR);
   for (Property idProp : getIds()) {
     String idValue = idProp.getStringValue();
     if (idValue == null) {
       throw new CompassException(
           "Missing id [" + idProp.getName() + "] for alias [" + getAlias() + "]");
     }
     sb.append(idValue);
     sb.append(SEPARATOR);
   }
   return sb.toString();
 }