Forums / Setup & design / howto exclude images from search

howto exclude images from search

Author Message

akiL Mussa

Monday 08 November 2004 4:37:56 am

Hi,

I'm trying to exclude images from the search. In the file templates/content/search.tpl I'm using the following code:

{let search=false()}
{section show=$use_template_search}
    {set page_limit=10}
    {set search=fetch(content,search,
                      hash(text,$search_text,
                           section_id,$search_section_id,
                           subtree_array,$search_subtree_array,
                           sort_by,array('modified',false()),
                           offset,$view_parameters.offset,
			   class_filter_type, "exclude",
			   class_filter_array, array(5),
                           limit,$page_limit))}
    {set search_result=$search['SearchResult']}
    {set search_count=$search['SearchCount']}
    {set stop_word_array=$search['StopWordArray']}
    {set search_data=$search}
{/section}

Is there any problem with this code?

Thanks,
akiL

Silke Fox

Monday 08 November 2004 4:53:55 am

Hi,

if images should never be searchable you could just change the image content class and set the text attributes to "non searchable".

Maybe that's an easy solution for you.

silke

akiL Mussa

Monday 08 November 2004 6:13:03 am

Silke,

Thanks for reply, but it doesn't works. I just cleared all chaches, but the search still showing the images.

The images are published like 'content' and not like 'media'. Could this cause this problem ?

Silke Fox

Monday 08 November 2004 6:57:07 am

akiL,

it shouldn't be a problem to publish images in the 'content' section.
Does debug output give any useful information?
You could check some database tables to find out if the search words are in there -
have a look at ezsearch_word and ezsearch_object_word_link.

You might also try to update the search index by script, see
http://ez.no/ez_publish/documentation/development/scripting/supplied_scripts/update_search_index.

Sorry, no more ideas for now...

akiL Mussa

Monday 08 November 2004 7:12:27 am

Ok Silke,

I'll try to do this checks.

thanks