Copy the content and the title property of the document to a spell field / a language specific spell field.
@param document the document that gets extended by the spell fields.
170881
private void appendSpellFields(I_CmsSearchDocument document) {

        /*
         * Add the content fields (multiple for contents with more than one locale)
         */
        // add the content_<locale> fields to this configuration
        String title = document.getFieldValueAsString(
            CmsPropertyDefinition.PROPERTY_TITLE + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT);
        document.addSearchField(
            new CmsSolrField(CmsSearchField.FIELD_SPELL, null, null, null),
            document.getFieldValueAsString(CmsSearchField.FIELD_CONTENT) + "\n" + title);
        for (Locale locale : OpenCms.getLocaleManager().getAvailableLocales()) {
            document.addSearchField(
                new CmsSolrField(locale + "_" + CmsSearchField.FIELD_SPELL, null, locale, null),
                document.getFieldValueAsString(
                    CmsSearchFieldConfiguration.getLocaleExtendedName(CmsSearchField.FIELD_CONTENT, locale))
                    + "\n"
                    + title);
        }
    }
329231
public static void setId(Object document, String id) {
		DocumentAccessor d = getAccessor(document);
		if (d.hasIdMutator()) {
			d.setId(document, id);
		}
	}
172340
void add_document(Document doc)
    {
        doc.feature().normalize();
        documents_.add(doc);
        composite_.add_vector(doc.feature());
    }
401432
public void setDocumentation(String doc) {
		if (Strings.isEmpty(doc)) {
			getSarlAnnotationType().eAdapters().removeIf(new Predicate<Adapter>() {
				public boolean test(Adapter adapter) {
					return adapter.isAdapterForType(DocumentationAdapter.class);
				}
			});
		} else {
			DocumentationAdapter adapter = (DocumentationAdapter) EcoreUtil.getExistingAdapter(
					getSarlAnnotationType(), DocumentationAdapter.class);
			if (adapter == null) {
				adapter = new DocumentationAdapter();
				getSarlAnnotationType().eAdapters().add(adapter);
			}
			adapter.setDocumentation(doc);
		}
	}
1204670
public PropertyDocument copy(PropertyDocument object) {
		return dataObjectFactory.getPropertyDocument(
				copy(object.getEntityId()),
				copyMonoLingualTextValues(object.getLabels().values()),
				copyMonoLingualTextValues(object.getDescriptions().values()),
				copyAliasMap(object.getAliases()),
				copyStatementGroups(object.getStatementGroups()),
				copy(object.getDatatype()),
				object.getRevisionId());
	}
782110
public static void addAll(Document document) {
        List<Element> elementList = getElements(document);

        List<String> elementIds = getElementsId(elementList);

        addAll(elementList);
    }
642836
public static void setVersion(Document doc, Version version) {
	Element root = doc.getDocumentElement();
	root.setAttribute("version", version.getMajor() + "." + version.getMinor());

    }
978974
public function setDocumentValue($document, $property, $value)
    {
        $setter = \Closure::bind(function ($document, $property, $value) {
                $document->$property = $value;
            }, null, $document
        );
        $setter($document, $property, $value);
    }
276258
static void serialize(final Document doc, final OutputStream os, final String encoding)
        throws TransformerFactoryConfigurationError, TransformerException, IOException
  {
    if (doc == null)
      throw new IllegalArgumentException("No document provided.");

    if (os == null)
      throw new IllegalArgumentException("No output stream provided");

    if (encoding == null || encoding.isEmpty())
      throw new IllegalArgumentException("No encoding provided.");

    final TransformerFactory transformerFactory = TransformerFactory.newInstance();
    transformerFactory.setAttribute("indent-number", Integer.valueOf(2));
    final Transformer t = transformerFactory.newTransformer();

    t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
    t.setOutputProperty(OutputKeys.METHOD, "xml");
    t.setOutputProperty(OutputKeys.INDENT, "yes");
    t.setOutputProperty(OutputKeys.ENCODING, encoding);

    final OutputStreamWriter osw = new OutputStreamWriter(os, encoding);
    t.transform(new DOMSource(doc), new StreamResult(osw));
    osw.flush();
  }
848792
public static void setActiveFieldValue(ODocument document, Boolean active) {
        setFieldValue(document, ACTIVE_FIELD, active.toString());
    }
807468
public static String getContentByDoc(Document doc) throws Exception {
        ContentExtractor ce = new ContentExtractor(doc);
        return ce.getContentElement().text();
    }
241437
private static void copyHeader(
		final Document doc,
		final Document ndoc) {
		NodeList headnl = doc.getElementsByTagName("head");

		if (headnl.getLength() > 0) {
			Element head = (Element) headnl.item(0);
			ndoc.getDocumentElement()
					.insertBefore(ndoc.adoptNode(head.cloneNode(true)),
					ndoc.getDocumentElement().getFirstChild());
		} // end if
	}
36284
public static ChangeEvent fromBsonDocument(final BsonDocument document) {
    keyPresent(Fields.ID_FIELD, document);
    keyPresent(Fields.OPERATION_TYPE_FIELD, document);
    keyPresent(Fields.NS_FIELD, document);
    keyPresent(Fields.DOCUMENT_KEY_FIELD, document);

    final BsonDocument nsDoc = document.getDocument(Fields.NS_FIELD);

    final UpdateDescription updateDescription;
    if (document.containsKey(Fields.UPDATE_DESCRIPTION_FIELD)) {
      updateDescription = UpdateDescription.fromBsonDocument(
          document.getDocument(Fields.UPDATE_DESCRIPTION_FIELD)
      );
    } else {
      updateDescription = null;
    }

    final BsonDocument fullDocument;
    if (document.containsKey(Fields.FULL_DOCUMENT_FIELD)) {
      final BsonValue fdVal = document.get(Fields.FULL_DOCUMENT_FIELD);
      if (fdVal.isDocument()) {
        fullDocument = fdVal.asDocument();
      } else {
        fullDocument = null;
      }
    } else {
      fullDocument = null;
    }

    return new ChangeEvent<>(
        document.getDocument(Fields.ID_FIELD),
        OperationType.fromRemote(document.getString(Fields.OPERATION_TYPE_FIELD).getValue()),
        fullDocument,
        new MongoNamespace(
            nsDoc.getString(Fields.NS_DB_FIELD).getValue(),
            nsDoc.getString(Fields.NS_COLL_FIELD).getValue()),
        document.getDocument(Fields.DOCUMENT_KEY_FIELD),
        updateDescription,
        document.getBoolean(Fields.WRITE_PENDING_FIELD, BsonBoolean.FALSE).getValue());
  }
1152584
@Override
  public ScriptElement createScriptElement(Document doc, String source) {
    ScriptElement elem = (ScriptElement) createElement(doc, "script");
    elem.setInnerText(source);
    return elem;
  }
184559
protected void formatRegion(IXtextDocument document, int offset, int length) {
		try {
			final int startLineIndex = document.getLineOfOffset(previousSiblingChar(document, offset));
			final int endLineIndex = document.getLineOfOffset(offset + length);
			int regionLength = 0;
			for (int i = startLineIndex; i <= endLineIndex; ++i) {
				regionLength += document.getLineLength(i);
			}
			if (regionLength > 0) {
				final int startOffset = document.getLineOffset(startLineIndex);
				for (final IRegion region : document.computePartitioning(startOffset, regionLength)) {
					this.contentFormatter.format(document, region);
				}
			}
		} catch (BadLocationException exception) {
			Exceptions.sneakyThrow(exception);
		}
	}
1141022
protected void addSplitAttributes(final GedDocument<?> document) {
        for (final GedDocument<? extends GedObject> attribute : document
                .getAttributes()) {
            final DocumentToApiModelVisitor v = createVisitor();
            attribute.accept(v);
            ((ApiHasImages) baseObject)
                    .addAttribute(convertToAttribute(v.getBaseObject()));
        }
    }
877444
protected void addAttributes(final GedDocument<?> document) {
        for (final GedDocument<? extends GedObject> attribute : document
                .getAttributes()) {
            final DocumentToApiModelVisitor v = createVisitor();
            attribute.accept(v);
            baseObject.getAttributes()
                    .add(convertToAttribute(v.getBaseObject()));
        }
    }