Esempio n. 1
0
        /// <summary>
        /// Adds all fields.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="item">The item to proceed</param>
        /// <param name="versionSpecific">if set to <c>true</c> this instance is version specific.</param>
        protected override void AddAllFields(Document document, Item item, bool versionSpecific)
        {
            item.Fields.ReadAll();

            Assert.ArgumentNotNull(document, "document");
            Assert.ArgumentNotNull(item, "item");
            foreach (Sitecore.Data.Fields.Field field in item.Fields)
            {
                if (!string.IsNullOrEmpty(field.Key) && !this.IsStandardField(field))
                {
                    bool             tokenize     = this.IsTextField(field);
                    FieldCrawlerBase fieldCrawler = FieldCrawlerFactory.GetFieldCrawler(field);
                    Assert.IsNotNull(fieldCrawler, "fieldCrawler");
                    if (this.IndexAllFields)
                    {
                        document.Add(CreateField(field.Key, fieldCrawler.GetValue(), tokenize, 1f));
                    }

                    if (tokenize)
                    {
                        document.Add(CreateField(Sitecore.Search.BuiltinFields.Content, fieldCrawler.GetValue(), tokenize, 1f));
                    }
                }
            }
        }
        private string GetFieldValue(Field field)
        {
            if (!IsTextField(field))
            {
                return(string.Empty);
            }

            FieldCrawlerBase fieldCrawler = FieldCrawlerFactory.GetFieldCrawler(field);

            return(fieldCrawler != null?fieldCrawler.GetValue() : string.Empty);
        }
        private string GetFieldValue(Field field)
        {
            if (IsTextField(field))
            {
                FieldCrawlerBase fieldCrawler = FieldCrawlerFactory.GetFieldCrawler(field);
                if (fieldCrawler != null)
                {
                    return(fieldCrawler.GetValue());
                }
            }

            return(string.Empty);
        }
        /// <summary>
        /// Adds all fields.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="item">The item.</param>
        /// <param name="versionSpecific">if set to <c>true</c> [version specific].</param>
        protected virtual void AddAllFields(Document document, Item item, bool versionSpecific)
        {
            Assert.ArgumentNotNull(document, "document");
            Assert.ArgumentNotNull(item, "item");

            foreach (Field field in item.Fields)
            {
                if (!string.IsNullOrEmpty(field.Key))
                {
                    bool             tokenize     = this.IsTextField(field);
                    FieldCrawlerBase fieldCrawler = FieldCrawlerFactory.GetFieldCrawler(field);
                    Assert.IsNotNull(fieldCrawler, "fieldCrawler");
                    if (this.IndexAllFields)
                    {
                        document.Add(this.CreateField(field.Key, fieldCrawler.GetValue(), tokenize, 1f));
                    }

                    if (tokenize)
                    {
                        document.Add(this.CreateField(BuiltinFields.Content, fieldCrawler.GetValue(), true, 1f));
                    }
                }
            }
        }