SenseNet.Search.Indexing.IndexDocumentInfo.AddField C# (CSharp) Method

AddField() public method

public AddField ( IndexFieldInfo fieldInfo ) : void
fieldInfo IndexFieldInfo
return void
        public void AddField(IndexFieldInfo fieldInfo)
        {
            fields.Add(fieldInfo);
        }

Same methods

IndexDocumentInfo::AddField ( string name, double value, Field store, bool isIndexed ) : void
IndexDocumentInfo::AddField ( string name, int value, Field store, bool isIndexed ) : void
IndexDocumentInfo::AddField ( string name, long value, Field store, bool isIndexed ) : void
IndexDocumentInfo::AddField ( string name, string value, Field store, Field index ) : void
IndexDocumentInfo::AddField ( string name, string value, Field store, Field index, Field termVector ) : void

Usage Example

Ejemplo n.º 1
0
        public static IndexDocumentInfo Create(Node node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            var textEtract = new StringBuilder();
            var doc        = new IndexDocumentInfo();

            doc._hasCustomField = node is IHasCustomIndexField;

            var ixnode = node as IIndexableDocument;

            if (ixnode == null)
            {
                doc.AddField(LucObject.FieldName.NodeId, node.Id, Field.Store.YES, true);
                doc.AddField(LucObject.FieldName.VersionId, node.VersionId, Field.Store.YES, true);
                doc.AddField(LucObject.FieldName.Version, node.Version.ToString().ToLower(), Field.Store.YES, Field.Index.ANALYZED);
                doc.AddField(LucObject.FieldName.CreatedById, node.CreatedById, Field.Store.YES, true);
                doc.AddField(LucObject.FieldName.ModifiedById, node.ModifiedById, Field.Store.YES, true);
            }
            else
            {
                var fieldNames = new List <string>();
                foreach (var field in ixnode.GetIndexableFields())
                {
                    if (PostponedFields.Contains(field.Name))
                    {
                        continue;
                    }
                    string extract;
                    var    lucFields = field.GetIndexFieldInfos(out extract);
                    textEtract.AppendLine(extract);
                    if (lucFields != null)
                    {
                        foreach (var lucField in lucFields)
                        {
                            fieldNames.Add(lucField.Name);
                            doc.AddField(lucField);
                        }
                    }
                }
            }

            //doc.AddField(LucObject.FieldName.NodeTimestamp, node.NodeTimestamp, Field.Store.YES, true);
            //doc.AddField(LucObject.FieldName.VersionTimestamp, node.VersionTimestamp, Field.Store.YES, true);
            doc.AddField(LucObject.FieldName.IsInherited, node.IsInherited ? BooleanIndexHandler.YES : BooleanIndexHandler.NO, Field.Store.YES, Field.Index.NOT_ANALYZED);
            doc.AddField(LucObject.FieldName.IsMajor, node.Version.IsMajor ? BooleanIndexHandler.YES : BooleanIndexHandler.NO, Field.Store.YES, Field.Index.NOT_ANALYZED);
            doc.AddField(LucObject.FieldName.IsPublic, node.Version.Status == VersionStatus.Approved ? BooleanIndexHandler.YES : BooleanIndexHandler.NO, Field.Store.YES, Field.Index.NOT_ANALYZED);
            doc.AddField(LucObject.FieldName.AllText, textEtract.ToString(), Field.Store.NO, Field.Index.ANALYZED);

            return(doc);
        }
All Usage Examples Of SenseNet.Search.Indexing.IndexDocumentInfo::AddField