Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

How to search only in certain section of website?


Go to End


7 Posts   3396 Views

Avatar
pga

Community Member, 8 Posts

8 August 2008 at 10:08am

I've got a website with a few sections e.g:

Section 1
+- article 11
+- article 12
+- article 13
Section 2
+- article 21
+- article 22
+- article 23

How to configure a search engine to search only in "section 2" tree?

Thank you for your help.

Avatar
pga

Community Member, 8 Posts

12 August 2008 at 1:04am

Can anybody help me how to search only in part of website?

Avatar
Blackdog

Community Member, 156 Posts

13 August 2008 at 11:02am

You need to checkout getResults function in AdvancedSearchForm.php and the searchEngine function in SearchForm.php

If you were to develop your own getResults coupled with an extended searchEngine function function you could specify a variable to limit which parts of the SiteTree you search.

Avatar
Blackdog

Community Member, 156 Posts

13 August 2008 at 11:04am

A nice idea, if it was a large site might be to provide a drop down with your search function which is populated by the SiteTree to allow for users to get a targeted search.

Avatar
pga

Community Member, 8 Posts

14 August 2008 at 1:25am

Thank you for ideas - I'll test it.

Avatar
Rahul

Community Member, 8 Posts

16 September 2008 at 10:08pm

Hi,

Please can u explain or give an example ...
How to implement this ?

Thanks
Rahul

Avatar
ojalà

Community Member, 87 Posts

10 October 2008 at 3:32am

Hi!
I have your same problem..what are the part of function that I must modify?