@Override void removeFieldFromDocument( Document document, String name ) { document.removeFields( name ); }
@Override void removeFieldFromDocument( Document document, String name ) { document.removeFields( exactKey( name ) ); document.removeFields( name ); }
private void clearDocument( Document document ) { Set<String> names = new HashSet<>(); for ( IndexableField field : document.getFields() ) { String name = field.name(); if ( LuceneExplicitIndex.isValidKey( name ) ) { names.add( name ); } } for ( String name : names ) { document.removeFields( name ); } }
public static void populateDocument(Document doc, Collection<FacetHandler<?>> handlers) { StringBuilder tokenBuffer = new StringBuilder(); for (FacetHandler<?> handler : handlers) { String name = handler.getName(); String[] values = doc.getValues(name); if (values != null) { doc.removeFields(name); for (String value : values) { doc.add(new StringField(name, value, Store.NO)); tokenBuffer.append(' ').append(value); } } } }
@Override public Document document(int n, FieldSelector fieldSelector) throws CorruptIndexException, IOException { Document doc = super.document(n, fieldSelector); Fieldable[] fields = doc.getFieldables(FieldNames.PROPERTIES); if (fields != null) { doc.removeFields(FieldNames.PROPERTIES); for (Fieldable field : fields) { String value = field.stringValue(); value = value.replace(oldSepChar, '['); doc.add(new Field(FieldNames.PROPERTIES, false, value, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS, Field.TermVector.NO)); } } return doc; }
public Document document(int n, FieldSelector fieldSelector) throws CorruptIndexException, IOException { Document doc = super.document(n, fieldSelector); Fieldable[] fields = doc.getFieldables(FieldNames.PROPERTIES); if (fields != null) { doc.removeFields(FieldNames.PROPERTIES); for (int i = 0; i < fields.length; i++) { String value = fields[i].stringValue(); value = value.replace('\uFFFF', '['); doc.add(new Field(FieldNames.PROPERTIES, value, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS)); } } return doc; }
@Override public Document document(int n, FieldSelector fieldSelector) throws CorruptIndexException, IOException { Document doc = super.document(n, fieldSelector); Fieldable[] fields = doc.getFieldables(FieldNames.PROPERTIES); if (fields != null) { doc.removeFields(FieldNames.PROPERTIES); for (Fieldable field : fields) { String value = field.stringValue(); value = value.replace(oldSepChar, '['); doc.add(new Field(FieldNames.PROPERTIES, false, value, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS, Field.TermVector.NO)); } } return doc; }
m_doc.removeFields(CmsSearchField.FIELD_META); m_doc.removeFields(CmsSearchField.FIELD_CONTENT); m_doc.removeFields(CmsSearchField.FIELD_DESCRIPTION); m_doc.removeFields(CmsSearchField.FIELD_KEYWORDS); m_doc.removeFields(CmsSearchField.FIELD_TITLE); m_doc.removeFields(CmsSearchField.FIELD_TITLE_UNSTORED);
if (doc.getField(key) != null) { log.trace("Removing field [{}] on document [{}]", key, docid); doc.removeFields(key); geofields.remove(key); if (doc.getField(add.key) != null) doc.removeFields(add.key); if (add.value instanceof Number) { Field field = null;
Document document = indexSearcher.doc(hint.doc); String[] participantValues = document.getValues(WITH.toString()); document.removeFields(WITH.toString()); for (String address : participantValues) { if (address.equals(participant.getAddress())) {
@Override protected Document finalizeDoc(Document doc, boolean dirty, boolean facet) throws IOException { if (facet && isFacetingEnabled()) { doc = getFacetsConfig().build(doc); } List<IndexableField> fields = doc.getFields(); // because of LUCENE-5833 we have to merge the suggest fields into a single one Field suggestField = null; for (IndexableField f : fields) { if (FieldNames.SUGGEST.equals(f.name())) { if (suggestField == null) { suggestField = FieldFactory.newSuggestField(f.stringValue()); } else { suggestField = FieldFactory.newSuggestField(suggestField.stringValue(), f.stringValue()); } } } doc.removeFields(FieldNames.SUGGEST); if (suggestField != null) { doc.add(suggestField); } return doc; }
@Override protected Document finalizeDoc(Document doc, boolean dirty, boolean facet) throws IOException { if (facet && isFacetingEnabled()) { doc = getFacetsConfig().build(doc); } List<IndexableField> fields = doc.getFields(); // because of LUCENE-5833 we have to merge the suggest fields into a single one Field suggestField = null; for (IndexableField f : fields) { if (FieldNames.SUGGEST.equals(f.name())) { if (suggestField == null) { suggestField = FieldFactory.newSuggestField(f.stringValue()); } else { suggestField = FieldFactory.newSuggestField(suggestField.stringValue(), f.stringValue()); } } } doc.removeFields(FieldNames.SUGGEST); if (suggestField != null) { doc.add(suggestField); } return doc; }
aDocument.removeFields (CPDStorage.FIELD_DELETED);
/** * Takes one single document and creates the visual words and adds them to the document. The same document is returned. * * @param d the document to use for adding the visual words * @return * @throws IOException */ public Document getVisualWords(Document d) throws IOException { clusters = Cluster.readClusters(clusterFile); int[] tmpHist = new int[clusters.length]; LireFeature f = getFeatureInstance(); IndexableField[] fields = d.getFields(localFeatureFieldName); // find the appropriate cluster for each feature: for (int j = 0; j < fields.length; j++) { f.setByteArrayRepresentation(fields[j].binaryValue().bytes, fields[j].binaryValue().offset, fields[j].binaryValue().length); tmpHist[clusterForFeature((Histogram) f)]++; } normalize(tmpHist); d.add(new TextField(visualWordsFieldName, arrayToVisualWordString(tmpHist), Field.Store.YES)); d.add(new StringField(localFeatureHistFieldName, SerializationUtils.arrayToString(tmpHist), Field.Store.YES)); d.removeFields(localFeatureFieldName); return d; }
d.removeFields(localFeatureFieldName);
doc.removeFields(FieldNames.FULLTEXT); Arrays.sort(fulltextFields, FIELDS_COMPARATOR_STORED); for (Fieldable f : fulltextFields) {
doc.removeFields(FieldNames.FULLTEXT); Arrays.sort(fulltextFields, FIELDS_COMPARATOR_STORED); for (Fieldable f : fulltextFields) {
d.removeFields(localFeatureFieldName);
d.add(new StoredField(vladFieldName, feat.getByteArrayRepresentation())); d.removeFields(localFeatureFieldName); return d;