SenseNet.ContentRepository.Storage.DataBackingStore.SaveIndexDocument C# (CSharp) Method

SaveIndexDocument() public static method

public static SaveIndexDocument ( Node node ) : IndexDocumentData
node Node
return IndexDocumentData
        public static IndexDocumentData SaveIndexDocument(Node node)
        {
            if (node.Id == 0)
                throw new NotSupportedException("Cannot save the indexing information before node is not saved.");

            node.MakePrivateData(); // this is important because version timestamp will be changed.

            var doc = IndexDocumentProvider.GetIndexDocumentInfo(node);
            long? docSize = null;
            byte[] bytes;
            if (doc != null)
            {
                using (var docStream = new MemoryStream())
                {
                    var formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                    formatter.Serialize(docStream, doc);
                    docStream.Flush();
                    docStream.Position = 0;
                    docSize = docStream.Length;
                    bytes = docStream.GetBuffer();
                    DataProvider.SaveIndexDocument(node.Data, bytes);
                }
            }
            else
            {
                bytes = new byte[0];
            }
            return CreateIndexDocumentData(node, bytes, docSize);
        }
        internal static IndexDocumentData CreateIndexDocumentData(Node node, object indexDocumentInfo, long? indexDocumentInfoSize)