Are MediaPointerPdfArray baseproduct fields indexed

Are baseproduct fields of type MediaPointerPdfArray indexed in Lucene? We have a set of media files and want to find all products that have pointers to any of the files. Searching with filter tags does not yield any result and trying to investigate by using a read tag it seems like there aren’t any values indexed.

Litium version: 5.6.0

Have you implemented any Litium.Studio.FieldFramework.IIndexFieldDocumentTagsConverter for the custom field?

Example

using System;
using System.Collections.Generic;
using System.IO;
using Litium.FieldFramework;
using Litium.Foundation.Modules.MediaArchive;
using Litium.Foundation.Search.Constants;
using Litium.Framework.Search.Indexing;
using Litium.Media;
using Litium.Runtime.DependencyInjection;

namespace Litium.Studio.FieldFramework.FieldFrameworkConverters
{
    [Service(Name = SystemFieldTypeConstants.MediaPointerFile)]
    internal class IndexDocumentTagMediaPointerFileField : IIndexFieldDocumentTagsConverter
    {
        private FileService _fileService;
        public IndexDocumentTagMediaPointerFileField(FileService fileService)
        {
            _fileService = fileService;
        }
        public ICollection<DocumentTag> ConvertToIndexDocumentTags(IndexFieldTypeConverterArgs arg, object item)
        {
            var result = new List<DocumentTag>();
            if (item == null)
            {
                return result;
            }

            var tagName = TagNames.GetTagNameForProperty(arg.FieldDefinition.Id);

            var value = (Guid)item;
            if (value != Guid.Empty)
            {
                if (ModuleMediaArchive.ExistsInstance)
                {
                    var file = _fileService.Get(value);
                    if (file != null && file.BlobUri != null)
                    {
                        result.Add(new DocumentTag(TagNames.FileId, file.SystemId) { Analyzed = true });
                        result.Add(new DocumentTag(TagNames.Body, file.Name) { Analyzed = true });
                        result.Add(new DocumentTag(TagNames.Body, Path.GetFileNameWithoutExtension(file.Name)) { Analyzed = true });
                    }
                }
            }
            return result;
        }
    }
}

No, did not know about that but will try. Is there documentation on this on the docs site?

Realized that the MediaPointerPdfArray is a custom type (that implements FieldTypeMetadataBase)…

Anyway, what’s the correct way to index an array of values? Should the IIndexFieldDocumentTagsConverter.ConvertToIndexDocumentTags() method return a collection of tags using the same tag name or should it contain a (serialized?) representation of all values?

The method should return a list of tags that you want added to the search index, see above example.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.