What I'm seeing in your application is that you are creating one
searcher, which is restricted to your site, and then adding it to your
control twice. Here's a rundown of what your script is doing, then:
1. Initializes the search control (Good).
2. Initializes the searcher options var options (Good).
3. Creates the searcher var siteSearch, initializes various settings
on it, and restricts it to your site (Good).
4. Adds the searcher to your control WITHOUT options (If you want the
searcher to show more than one result off the bat, this is not good.).
5. Sets the options expand mode to open (Good).
6. Re-adds the searcher to your control WITH options (This effectively
steals the searcher from the first section of your control because it
will reset the search complete callback to drop results into the
second section, despite the fact that the first section's elements
will all remain. BUT, when I search for "car", there are four results
returned and posted into this section. So this is Good.).
You will notice a couple of things: there is no point where you ask
for a large resultset because, even though the call is in the code,
it's commented out by the preceding //. So you will only get a small
resultset of 4 results at a time. This is an important thing to note
because, even with the large resultset, you will only ever receive up
to 8 results at a time, but you can click through 4 pages results (for
a total of 16 results with the small set or 32 with the large). If
you want more results than that, you're going to have to roll your own
CSE (which the search control will direct the "More Results" link to)
or build your own search API.
All of that to say, the best you're going to do is to remove the first
searchControl.addSearcher(siteSearch); completely, and uncomment the
line reading searchControl.setResultSetSize(...);
jgee...@mchsi.com
If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!