Would you like to not index the files, or just not want the files to be shown in the public search results ?
are you using Find (Search & Navigation)
Thanks Quan. Yes, we are using Search & Nav.
I can't think of why any of our uploaded files need to be indexed, but either way should achieve the immediate goal.
You can add a convention to prevent those files from being indexed. P/s you should update to latest version of Form if you haven't already
Adding a convention is one thing I was looking at, but how do I target files specifically uploaded via the FileUpload element?
Re: EPiServer.Forms, I am on the latest
A quick way to do it - not bulletproof but probably good enough, is check a file of type IContentMedia if it belongs to folder named EPiServer.Forms.Constants.FileUploadFolderName before indexing
Quan, I'm making a guess you are referring to something like:
ContentIndexer.Instance.Conventions.ForInstancesOf<IContentMedia>().ShouldIndex(x => x.???)
If so, how would I check for it's containing folder?
If not, can you share more info on how to do this?
Yes, you can get its parent, something like this (pseudo code of course)
x => {
var parent = _contentRepo.Get<ContentFolder>(x.ParentLink);
if (parent.Name == EPiServer.Forms.Constants.FileUploadFolderName) { return false ; }
return true;
}
I'll try this. I'll add this to our SearchInitialization module, which I assume is used during indexing. I am wondering though... could this approach have a significant impact on performance of indexing? I suppose I needn't be too concerned about the overnight job, but wanted to check.
it depends on how many files you have - and under how many folders. if you have many files but only a few folders it would not take a lot of time (Get<T> is cached )
If we take a step back, this should not happen. Can you please reach out to support at support@optimizely.com, refer to this thread and cc me (quan.mai [at] optimizely.com ) ? we are interested in looking into this. thank you
Hello all,
We have forms that use a FileUpload form element, with a link sent via email. The uploaded files are linked to a /contentassets/../uploaded-files/ folder. It makes sense that these files are findable in our site search, but that is not desirable for us.
Question: how do I exclude these uploaded files from search? How do I identify this type of search result? My experience is limited with Opti's search in general, plus the custom code I inherited.
Thanks, Kevin