Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Setting search scope programtically View modes: 
User avatar
Member
Member
steven.jack-octopusmt - 3/2/2009 6:27:21 AM
   
Setting search scope programtically
Hello,

I would like to implement the search facility, and was wondering if you were able to set the scope of the search webpart programmatically. What I want is to be able to allow the user to filter out what they are searching for, such as News, Articles or showcases for example... so that if they select “news” and type “example” then they would only get results that were news items ... can this be done?

Kind regards,

Steven Jack

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 3/3/2009 4:01:44 AM
   
RE:Setting search scope programtically
Hello,

you could change the bahavior of our standard search web parts – please see here:
http://devnet.kentico.com/docs/devguide/modifying_web_part_behavior.htm
for more information about modifying web part behavior.

The needful properties for your purposes are:
ClassNames – restrict the documents to be only of specified document type(s).
Path – restrict the documents to be only in the specified subtree of content tree.

Please see here for more information:
http://devnet.kentico.com/docs/controls/cmssearchdialog_cmssearchresul.htm
about our searching controls.

Best regards,
Helena Grulichova

User avatar
Member
Member
marko-softing - 3/13/2009 10:57:43 AM
   
RE:Setting search scope programtically
Hello,

Have the same problem, so steve please help if you have some solution. Thanks

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 3/18/2009 7:49:44 AM
   
RE:Setting search scope programtically
Hi Marko,

you can create copy of search box and search results web parts (http://www.kentico.com/docs/devguide/modifying_the_design_of_standa.htm) and modify them as you need.

You can add some dropdown list into search box web part and modify the Search() method of this web part so it pass selected value as query string parameter to search results page.

Then you can modify search results web part so it will read the value in query string parameter and set the this.srchResults.ClassNames or this.srchResults.Path or this.srchResults.WhereCondition properties in SetupControl() method of search results web part accordingly.

Best Regards,

Martin Dobsicek