List of usage examples for org.apache.lucene.document StoredField StoredField
public StoredField(String name, double value)
From source file:net.semanticmetadata.lire.indexing.tools.ProximityHashingIndexor.java
License:Open Source License
/** * Overwrite this method if you want to filter the input, apply hashing, etc. * * @param feature the current feature. * @param document the current document. * @param featureFieldName the field hashFunctionsFileName of the feature. *///w w w. j av a 2s .com protected void addToDocument(LireFeature feature, Document document, String featureFieldName) { if (run == 0) { } // just count documents else if (run == 1) { // Select the representatives ... if (representativesID.contains(docCount) && feature.getClass().getCanonicalName().equals(featureClass.getCanonicalName())) { // it's a representative. // put it into a temporary data structure ... representatives.add(feature); } } else if (run == 2) { // actual hashing: find the nearest representatives and put those as a hash into a document. if (feature.getClass().getCanonicalName().equals(featureClass.getCanonicalName())) { // it's a feature to be hashed int[] hashes = getHashes(feature); document.add(new TextField(featureFieldName + "_hash", createDocumentString(hashes, hashes.length), Field.Store.YES)); document.add(new TextField(featureFieldName + "_hash_q", createDocumentString(hashes, 10), Field.Store.YES)); } document.add(new StoredField(featureFieldName, feature.getByteArrayRepresentation())); } }
From source file:net.simpleframework.ado.lucene.LuceneDocument.java
License:Apache License
public void addStoredField(final String name, final String value) { doc.add(new StoredField(name, value)); }
From source file:net.ymate.platform.module.search.Searchs.java
License:Apache License
/** * @param searchable /*from w ww . ja v a 2s. c om*/ * @return ??Document */ private static Document __doIndexDocumentCreate(ISearchable searchable) { IndexedMeta _meta = null; if (searchable == null || (_meta = getIndexedMeta(searchable)) == null || _meta.isEmpty()) { return null; } ClassBeanWrapper<?> _wrapper = ClassUtils.wrapper(searchable); Document _doc = new Document(); _doc.add(new StoredField(IndexedMeta.TARGET_CLASS_NAME, searchable.getClass().getName())); for (String _fName : _meta.getFieldNames()) { if (IndexedMeta.FIELD_ID.equals(_fName)) { _doc.add(new StringField(IndexedMeta.FIELD_ID, new BlurObject(_wrapper.getValue(IndexedMeta.FIELD_ID)).toStringValue(), _meta.getIndexField(IndexedMeta.FIELD_ID).isStore() ? Store.YES : Store.NO)); continue; } __doProcessDocumentField(_doc, _wrapper, _fName, _meta.getIndexField(_fName)); } return _doc; }
From source file:org.apache.blur.analysis.type.AclDiscoverFieldTypeDefinition.java
License:Apache License
@Override public Iterable<? extends Field> getFieldsForColumn(String family, Column column) { String fieldName = getFieldName(); String value = column.getValue(); List<Field> fields = new ArrayList<Field>(); fields.add(new DocumentVisiblityField(INTERNAL_FIELDNAME, value, Store.NO)); fields.add(new StoredField(fieldName, value)); if (isSortEnable()) { fields.add(new SortedDocValuesField(fieldName, new BytesRef(value))); }/* ww w .ja v a2 s .c o m*/ return fields; }
From source file:org.apache.blur.analysis.type.DateFieldTypeDefinition.java
License:Apache License
@Override public Iterable<? extends Field> getFieldsForColumn(String family, Column column) { String name = getName(family, column.getName()); long date = parseDate(column.getValue()); LongField field = new LongField(name, date, _typeNotStored); StoredField storedField = new StoredField(name, column.getValue()); List<Field> fields = new ArrayList<Field>(); fields.add(field);/*w w w. jav a 2 s. c o m*/ fields.add(storedField); if (isSortEnable()) { fields.add(new NumericDocValuesField(name, date)); } return fields; }
From source file:org.apache.blur.analysis.type.spatial.BaseSpatialFieldTypeDefinition.java
License:Apache License
@Override public Iterable<? extends Field> getFieldsForColumn(String family, Column column) { synchronized (_strategy) { String name = getName(family, column.getName()); if (!_strategy.getFieldName().equals(name)) { throw new RuntimeException("Strategy name and column name do not match."); }//from www. j av a 2 s. c o m List<Field> fields = new ArrayList<Field>(); Shape shape = getShape(column); checkShape(shape); for (Field f : _strategy.createIndexableFields(shape)) { fields.add(f); } fields.add(new StoredField(name, column.getValue())); return fields; } }
From source file:org.apache.blur.analysis.type.StoredFieldTypeDefinition.java
License:Apache License
@Override public Iterable<? extends Field> getFieldsForColumn(String family, Column column) { String name = getName(family, column.getName()); return makeIterable(new StoredField(name, column.getValue())); }
From source file:org.apache.blur.utils.ResetableDocumentStoredFieldVisitor.java
License:Apache License
@Override public void binaryField(FieldInfo fieldInfo, byte[] value) throws IOException { doc.add(new StoredField(fieldInfo.name, value)); addSize(fieldInfo, _emptyByteArrayFieldSize); size += value.length;// ww w.j a va 2 s . c om }
From source file:org.apache.blur.utils.ResetableDocumentStoredFieldVisitor.java
License:Apache License
@Override public void intField(FieldInfo fieldInfo, int value) { doc.add(new StoredField(fieldInfo.name, value)); addSize(fieldInfo, _integerFieldSize); }
From source file:org.apache.blur.utils.ResetableDocumentStoredFieldVisitor.java
License:Apache License
@Override public void longField(FieldInfo fieldInfo, long value) { doc.add(new StoredField(fieldInfo.name, value)); addSize(fieldInfo, _longFieldSize); }