# Octopress Search Error

## Problem

I used the search box in the navigation bar to search for pages in this blog.

</source>

It had been working well, but a month ago, the box searched for webpages other than those in this blog.

</source>

How to limit the search to pages within this site only?

## Discussion

I read the generated HTML code for the search box, and compared the difference between a version of an HTML file in November, and another version in early October. However, I couldn’t find out the reason.

## Solution

### Fix the problem

I found the page Add a Search Box from the Columbia University. I followed the steps for limiting the search by site.6 Without the line <input type="hidden" name="as_dt" value="i"/> in source/_includes/navigation.html, the search box still work fine.

### Test the fix

In the past, I used rake preview to detect any errors. As the number of posts and pages grew, this method has become inefficient.

While testing the instructions in this guide, I put the HTML code for the custom search box in an HTML file, and viewed the effects in Firefox. The URL variable ei was still there, but the custom search was restricted to this site only.

After solving this problem, I discovered another solution in the pull requests of Octopress.7

Now, the problem has been fixed.8

1. See commit befd4a7 on the source branch for details.

2. See commit 2e56754 on the master branch for details.

3. See commit 6ea49e8 on the source branch for details.

4. See commit 31c066a on the master branch for details.

5. See commit af4f216 on the source branch for details.

6. See commit 35955df on the source branch for details.

7. See Octopress issue 1681 for details.

8. See commit 514ed5e on the master branch of Octopress’s repository on GitHub.