# How do you confine a search to a certain page and its childr

**URL:** <https://www.ruby-forum.com/t/how-do-you-confine-a-search-to-a-certain-page-and-its-childr/77608>\
**Category:** Radiant CMS\
**Created:** [November 29, 2006, 4:41am UTC](https://www.ruby-forum.com/t/how-do-you-confine-a-search-to-a-certain-page-and-its-childr/77608 "2006-11-29T04:41:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike-moscow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@mike-moscow](https://www.ruby-forum.com/u/mike-moscow)\
**Post date:** [November 29, 2006, 4:41am UTC](https://www.ruby-forum.com/t/how-do-you-confine-a-search-to-a-certain-page-and-its-childr/77608/1 "2006-11-29T04:41:52Z")

</div>

I’m using the search behavior modified by john for ruby-lang. How would  
I go  
about restricting the search to just a certain page and it children. So  
that it  
could only return results from that page and its children.

-Anthony

---

<div class="post-metadata">

**Author:** ![mike-moscow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@mike-moscow](https://www.ruby-forum.com/u/mike-moscow)\
**Post date:** [November 29, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/how-do-you-confine-a-search-to-a-certain-page-and-its-childr/77608/2 "2006-11-29T14:02:59Z")

</div>

Mike Moscow wrote:

> I’m using the search behavior modified by john for ruby-lang. How would I go  
> about restricting the search to just a certain page and it children. So that it  
> could only return results from that page and its children.

As that behavior just does a “like” query on the pages and page\_parts  
table there is not an easy way to constrain it. You may be able to  
modify it to discard any matches that do not have a certain page in  
their ancestors, but I don’t know of any way to make this happen with  
sql.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![mike-moscow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@mike-moscow](https://www.ruby-forum.com/u/mike-moscow)\
**Post date:** [December 6, 2006, 4:47pm UTC](https://www.ruby-forum.com/t/how-do-you-confine-a-search-to-a-certain-page-and-its-childr/77608/3 "2006-12-06T16:47:49Z")

</div>

> their ancestors, but I don’t know of any way to make this happen with sql.

I’m interested in restricted search results as well. Please post back  
to the  
list if you come up with some ideas. I’ll do the same.

Todd M

---

<div class="post-metadata">

**Author:** ![mike-moscow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@mike-moscow](https://www.ruby-forum.com/u/mike-moscow)\
**Post date:** [December 6, 2006, 5:03pm UTC](https://www.ruby-forum.com/t/how-do-you-confine-a-search-to-a-certain-page-and-its-childr/77608/4 "2006-12-06T17:03:02Z")

</div>

Hi, I ended up removing the search behavior altogether. And used this  
little ‘fake’ javascript search engine I found. You have to actually  
set up an xml file for it to search. Its a pain in the rear but It  
was a last resort solution because I had invested too many hours into  
the project already. If you’re interested check it out:

[http://www.tipue.com/products/tipueJS/](http://www.tipue.com/products/tipueJS/)

Its open source, quick and easy to set up. (this is an non-biased  
review of it since I am in no way affiliated with them)
