The thing I want to do is to find following that contains the searched text:
I want to make an extension method where I can check every searched ISearchContent if it also fulfills the criterias listed above.
On our site we have several search pages with different search roots.
Any suggestions?!
Have you included the field/method Test() so it exists on all items in in the index? The filtering takes place in the search engine, so it must exist in the index.
I have now :)
But how do I add the method to the index? I have EPiServer Find Version 7.0.586.24.
I have added a FindHelpers class with this method:
public static IEnumerable<int> AncestorsForPagesWithFileReference<T>(this T file) where T : UnifiedFile { var ancestorLinks = new HashSet<int>(); ... ... }
But how am I supposed to add this method to the index for all UnifiedFile's?
I hoped that I could do something like:
FileIndexer.Instance.Conventions.ForInstancesOf<UnifiedFile>().IncludeField(x => x.AncestorsForPagesWithFileReference());
But FileIndexer does not support the IncludeField method...
Any suggestions?
By the way, I've found this in the forum but I guess that is for EPiServer Find 7.5:
http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=79729&epslanguage=en
Try using SearchClient instead of FileIndexer. Haven't tested it, but I suppose that should work.
It works!
SearchClient.Instance.Conventions.ForInstancesOf<UnifiedFile>().IncludeField(x => x.AncestorsForPagesWithFileReference());
But the next thing is to index files when the references to them are updated (as I have understood from another forum post).
I can listen to PublishedContent event for blocks and pages. But what should I do when a page/block with file references is deleted or if it expires (StopPublish). Are there any events to fetch then?
Are there any other scenarios when a file reference can be "deleted"?
You can set related content to content, and when the related content is changed the content is re-indexed.
ContentIndexer.Instance.Conventions.ForInstancesOf<IContent>().RelatedContent(c => c.RelatedPages())
But isn't the RelatedContent supposed to return a list of IContent? I want to reindex a list of files which is not IContent but a UnifiedFile in EPiServer Find Version 7.0.586.24.
I think Johan means that you set it up so that you use related pages so that if a page has a relation to a file it will also update the related file.
I am using UnifiedSearch and want to filter with an extension method like below:
The extension method Test:
The problem is that I am getting no hits...
And yes, the filter method will be more complex :)
What am I doing wrong?