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).
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);
}
}
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
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
Thanks Hendy
Does it search in media section ?
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:
is working on a reply...