Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • William Djingga 27 posts 53 karma points
    Jan 17, 2011 @ 02:48
    William Djingga
    0

    Does Examine index / search the media node attribute ?

    Hi all,

    I have a Media type that is inherited from Image media type. 

    i.e. : map media type which has 'area' and 'description' attributes apart from the standard size, file type, upload file attributes.

    Does Examine support indexing/ searching the attributes in the media nodes or content nodes only?

    I tried to add the attributes to the examine.config and have no luck with it.

    config : <IndexAttributeFields>

    <add Name="id" />

    <add Name="nodeName"/>

    <add Name="nodeTypeAlias" />

    <add Name="path" />

    <add Name="parentID" />

    </IndexAttributeFields>

    <IndexUserFields>

    <add Name ="pageTitle" />

    <add Name ="mainBody" />

    <add Name ="area" /> --> media attributes

    <add Name ="description" /> --> media node attributes

    Anyone has the same problem and any workarounds on how to search for media attributes?

    Thanks

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jan 17, 2011 @ 08:44
    Hendy Racher
    0

    Hi Uiru,

    I'm no expert on Examine, but as it's provider based, I can't see any reason why index and search providers for the Media section couldn't be written - by default Umbraco only pushes the published nodes in the Content tree into an XML file, but it's also possible to generate XML data from the Media nodes (snippets of XML for each node exist in the cmsContentXml) - so perhaps generating a second XML file for the media section and reusing the existing providers would be possible ?

    As a workarround, how about searching the Media section via XPath, there's a helper method GetMediaByXPath() in the uQuery library (which is a part of uComponents).

    HTH,

    Hendy

  • William Djingga 27 posts 53 karma points
    Jan 17, 2011 @ 18:26
    William Djingga
    0

    Thanks Hendy

     

  • loic ponchon 36 posts 56 karma points
    Sep 23, 2011 @ 11:05
    loic ponchon
    0

    Does it search in media section ?

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Sep 23, 2011 @ 12:47
    Dan Diplo
    2

    The default Examine provider indexer (UmbracoExamine.UmbracoContentIndexer) doesn't index the content of media files, though it does iterate over them. You can inherit from it and override the AddDocument method to extend it to do so. A very basic example would be:

    public class ContentAndDocumentIndexer : UmbracoExamine.UmbracoContentIndexer
    {
        protected override void AddDocument(Dictionary<string, string> fields, Lucene.Net.Index.IndexWriter writer, int nodeId, string type)
        {
            if (type.ToLower() == "media")
            {
                if (fields.ContainsKey("umbracoFile"))
                {
                    // Do your custom indexing here...
                }
            }
    
            base.AddDocument(fields, writer, nodeId, type);
        }
    }
Please Sign in or register to post replies

Write your reply to:

Draft