Bug: Search function Blocks and Media

Vote:
 

Currently I am unable to use the search function for blocks or media. It will always return zero results, even if we know a file with that name is avilable. Is there something wrong with our implementation of Episerver 10? Is something not turned on that should be indexing content in the CMS?

#183945
Oct 24, 2017 22:38
Vote:
 

Are you using the built in search or Find?

#183977
Oct 25, 2017 10:49
Vote:
 

Built-in search.

Our Episerver partner set-up this instance.

#183981
Edited, Oct 25, 2017 15:13
Vote:
 

Have you installed the episerver.search nuget package?

Unless you are using Episerver Find as Henrik Fransas suggested.

#183982
Oct 25, 2017 15:20
Vote:
 

Then if you can find them in the edit mode but not on the web page your episerver partner has not done a correct job.
Propbably they have forgot to add them as source on where to search

#183983
Oct 25, 2017 15:22
Vote:
 

We are experiencing a problem that media are not searchable in the Media pane in Episerver CMS Edit. The site itself is using Episerver Find, and Episerver Search is set to active=false.

#184418
Oct 26, 2017 12:11
Vote:
 

I don't know if Find have another support for it but the default is that you need episerver.search active to search for media in CMS admin.

Installing the episerver.search nuget will set active=true.

#184421
Oct 26, 2017 13:16
Vote:
 

I just found the reason for this.. I have disabled indexing of my ImageFile objects in Episerver Find to hide them from site search, not knowing this would hide from internal media search too.

#184422
Oct 26, 2017 13:17
Vote:
 

Hi

An old ticket but still posting my answer to help other people facing the same issue. As mentioned above one of our clients was having the same issue. Upon reviewing their code found the following lines of code

ContentIndexer.Instance.Conventions.ForInstancesOf<IContent>().ShouldIndex(x => false); - Dasables block searches

ContentIndexer.Instance.Conventions.ForInstancesOf<ImageFile>().ShouldIndex(x => false);
ContentIndexer.Instance.Conventions.ForInstancesOf<GenericMedia>().ShouldIndex(x => false); - Disables image searches.

Unfortunatley this stops the internal Edit menu search too. 

You need to remove the above code and filter the search results on your search page to not return images and blocks.

Seems to work for us.

If anyone has any other solution to this I am all ears.

Thanks

Kind Regards

Sandeep

#196701
Sep 09, 2018 10:46
Vote:
 

Sometimes you may have a reason to not index everything. This could be the case if you have content that never needs to be returned in a query, or maybe you have some private information that shouldn't be stored in the index. You may simply be trying to keep the size of your index down and have made some sacrifises in terms of what gets indexed.

For whatever reason that you don't want to index tpes of content, restrict indexing by doing something like 

 
ContentIndexer.Instance.Conventions.ForInstancesOf<YOURCONTENTTYPE>().ShouldIndex(x => false)

Unless you have a reason for not storing all of your content within the index, remove all indexing restrictions. This will ensure that it is searchable in the authoring instance of Episerver.

If you are indexing everything but only want to return content of a specific type, then include that in your query.

One last thing:

ContentIndexer.Instance.Conventions.ForInstancesOf<IContent>().ShouldIndex(x => false);

does not simply remove blocks from the index, but also any page/media/product/etc. content that implements IContent. To understand the full ramifications of this please see this page which contains a diagram showing what I mean https://world.episerver.com/documentation/developer-guides/CMS/Content/

#196706
Sep 10, 2018 6:51
Vote:
 

Sometimes you may have a reason to not index everything. This could be the case if you have content that never needs to be returned in a query, or maybe you have some private information that shouldn't be stored in the index. You may simply be trying to keep the size of your index down and have made some sacrifises in terms of what gets indexed.

For whatever reason that you don't want to index tpes of content, restrict indexing by doing something like 

 
ContentIndexer.Instance.Conventions.ForInstancesOf<YOURCONTENTTYPE>().ShouldIndex(x => false)

Unless you have a reason for not storing all of your content within the index, remove all indexing restrictions. This will ensure that it is searchable in the authoring instance of Episerver.

If you are indexing everything but only want to return content of a specific type, then include that in your query.

One last thing:

ContentIndexer.Instance.Conventions.ForInstancesOf<IContent>().ShouldIndex(x => false);

does not simply remove blocks from the index, but also any page/media/product/etc. content that implements IContent. To understand the full ramifications of this please see this page which contains a diagram showing what I mean https://world.episerver.com/documentation/developer-guides/CMS/Content/

#196707
Edited, Sep 10, 2018 6:51
Vote:
 

Sometimes you may have a reason to not index everything. This could be the case if you have content that never needs to be returned in a query, or maybe you have some private information that shouldn't be stored in the index. You may simply be trying to keep the size of your index down and have made some sacrifises in terms of what gets indexed.

For whatever reason that you don't want to index tpes of content, restrict indexing by doing something like 

 
ContentIndexer.Instance.Conventions.ForInstancesOf<YOURCONTENTTYPE>().ShouldIndex(x => false)

Unless you have a reason for not storing all of your content within the index, remove all indexing restrictions. This will ensure that it is searchable in the authoring instance of Episerver.

If you are indexing everything but only want to return content of a specific type, then include that in your query.

One last thing:

ContentIndexer.Instance.Conventions.ForInstancesOf<IContent>().ShouldIndex(x => false);

does not simply remove blocks from the index, but also any page/media/product/etc. content that implements IContent. To understand the full ramifications of this please see this page which contains a diagram showing what I mean https://world.episerver.com/documentation/developer-guides/CMS/Content/

#196708
Sep 10, 2018 6:51
Vote:
 

Sometimes you may have a reason to not index everything. This could be the case if you have content that never needs to be returned in a query, or maybe you have some private information that shouldn't be stored in the index. You may simply be trying to keep the size of your index down and have made some sacrifises in terms of what gets indexed.

For whatever reason that you don't want to index tpes of content, restrict indexing by doing something like 

 
ContentIndexer.Instance.Conventions.ForInstancesOf<YOURCONTENTTYPE>().ShouldIndex(x => false)

Unless you have a reason for not storing all of your content within the index, remove all indexing restrictions. This will ensure that it is searchable in the authoring instance of Episerver.

If you are indexing everything but only want to return content of a specific type, then include that in your query.

One last thing:

ContentIndexer.Instance.Conventions.ForInstancesOf<IContent>().ShouldIndex(x => false);

does not simply remove blocks from the index, but also any page/media/product/etc. content that implements IContent. To understand the full ramifications of this please see this page which contains a diagram showing what I mean https://world.episerver.com/documentation/developer-guides/CMS/Content/

#196709
Sep 10, 2018 6:51
Vote:
 

Hi Marcus

Thanks for the reply. The client's developers had done the code. I have asked for the reason for doing this. Most probably as you have said might be to keep the size of the index down.

Not great that both searches are tied up as they would need to index thousands of images for this to work.

I had already updated the code in lines of your feedback. 

Thanks again

Kind Regards

Sandeep

#196715
Sep 10, 2018 9:19
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.