Author Topic

Balazs Halasy

Monday 03 May 2004 4:28:43 am

Comment40581

Hi,

You'll have to use "advancedsearch" instead of just plain "search". The
following code demonstrates how you can let users search for only articles
and folders (content class 1 and 2) using the advanced search method:

<form action={"/content/advancedsearch/"|ezurl} method="post">
<input type="text" size="20" name="SearchText" value="" />
<input type="hidden" name="SearchContentClassID[]" value="1" />
<input type="hidden" name="SearchContentClassID[]" value="2" />
<input name="SearchButton" type="submit" value="Search" />
</form>

Use the "SearchContentClassID[]" to specify which classes that should be
returned. In the example above, we search for folders (1) and articles (2).
Also, make sure that you use the HTTP POST method, as demonstrated in the
code above (instead of GET, which is the default and which makes things
appear in the URL). When using the POST method, things will not appear in the
URL, and people will not be able to mess around with it.

However, the POST method can still be "hacked" by a user who is able to fake a
POST request. I think very few users would do this. BUT: if you *really* need
high level of "security" then you should either disable searching within the
attributes of the classes that shouldn't be searched (and then reindex the
entire content tree) or setup some kind of role/permission settings that
prevent people for viewing the "secure" part of your content.

Cheers.

Balazs