I've never tried this, but could you try adding the custom property to the internal Examine index?
In /Config/ExamineIndex.config change:
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/"/>
to:
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/">
<IndexUserFields>
<add Name="YOUR_FOTOGRAPHER_PROPERTY_ALIAS" />
<IndexUserFields>
</IndexSet>
I'm curious if this would work! Don't forget to rebuild the index from the Developer tab!
To get around this issue I thought I'd be clever and put the tags into the same Examine field as the nodeName using an event handler for GatheringNodeData. However, it turns out that the name you see in the search results is what is in the Examine index, not the name of the node from the media item - so it looked pretty bad.
I ended up doing something similar to the following, which still isn't great, but gives them the functionality they need and the tags are appended in a way that makes it look somewhat deliberate...
public class MediaExamineEventHandler : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ExamineManager.Instance.IndexProviderCollection["InternalIndexer"].GatheringNodeData += MediaExamineEventHandler_GatheringNodeData;
}
private void MediaExamineEventHandler_GatheringNodeData(object sender, IndexingNodeDataEventArgs e)
{
if (e.IndexType == IndexTypes.Media)
{
if (e.Fields.ContainsKey("tags"))
{
var tagsValue = e.Fields["tags"].Replace(",", ", ");
e.Fields["nodeName"] += $" [Tags: {tagsValue}]";
}
}
}
}
If anyone has a better solution I'd appreciate the input! Until then, I hope this helps somebody.
making custom image properties searchable
Is there a simple way to make cutom media properties searchable in the backoffice?
In the example below, i would like to be able to find photos by photographer and tags, but the media seach only searches the name as default...
I've never tried this, but could you try adding the custom property to the internal Examine index?
In /Config/ExamineIndex.config change:
to:
I'm curious if this would work! Don't forget to rebuild the index from the Developer tab!
Upon further inspection, they are actually already in the index... they just don't return results... :|
Shouldn't your own properties be in:
And not:
As that is only the built in properties?
Doubt this will have any effect, but worth a shot moving "writerName" into "IndexUserFields" !
Im back I spotted an obvious error as my custom properties had been added to the member index. Now my Examineindex.config looks like this:
But still no luck in making "fotograf" and "Tags searchable"... :( Any Examine experts in the house?
I need to add user fields to the internal search engine as well. Unfortunately it only searches the nodeName, despite what you include in the index. See http://stackoverflow.com/questions/33255243/searching-other-fields-in-the-internal-backoffice-search-box-v7-1-0.
Does anyone have an idea for a workaround for this issue?
This is an old-ish thread but I thought I'd post for anyone who finds it in the future as I found it while looking for a solution to this myself.
A client wants the ability to add tags to media items to make it easier to find them in the back-end media search.
I decided to delve into the source and, as Erik says above, it seems Umbraco only searches specific fields, primarily nodeName.
https://github.com/umbraco/Umbraco-CMS/blob/e0025db56d52b770d2b3aedbd48a3b804fd15ef0/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs#L42
Then nodeName is hardcoded into the query here:
https://github.com/umbraco/Umbraco-CMS/blob/e0025db56d52b770d2b3aedbd48a3b804fd15ef0/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs#L150
To get around this issue I thought I'd be clever and put the tags into the same Examine field as the nodeName using an event handler for GatheringNodeData. However, it turns out that the name you see in the search results is what is in the Examine index, not the name of the node from the media item - so it looked pretty bad.
I ended up doing something similar to the following, which still isn't great, but gives them the functionality they need and the tags are appended in a way that makes it look somewhat deliberate...
If anyone has a better solution I'd appreciate the input! Until then, I hope this helps somebody.
is working on a reply...