right ID in the CSS file for the text at the bottom of the search
results (in dark purple): I don't see any dark purple text. Did you
find this, or am I missing something?
The search results page doesn't show the code displaying the
results... when I view page source: No, because the results are
generated dynamically within the Javascript. If you use Firefox, you
can see what the code would look like by highlighting the search
results, right-clicking, and selecting "View Selection Source."
Probably even more useful, though, is Firefox with the Firebug add-on
installed; Firebug allows you to inspect elements in depth. Absolutely
essential for development. I cannot overemphasize that!
I get 3-5 results (depending on the search term): I just ran a test
for "ross," and it returned a full load of results. Do you have a
sample search where this behavior is exhibited?
when I click on "more results" a lot more results come up: Yeah, this
is a known bug. It's in the issue tracker; you can star it there to
tell the devteam that you'd like it fixed.
search.setQueryAddition: You're probably needing to use
siteSearch.setQueryAddition("filetype:html");
Jeremy R. Geerdes
Effective website design & development
Des Moines, IA
For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
[email protected]
Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.
If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!
And check out my blog, Adventures in Web Development, at
http://jgeerdes.blogspot.com
!
On May 15, 2009, at 7:00 AM, ChrisRoss wrote:
>
> Excellent, got it working with CSS styles and larger result set,
> though I have a couple of minor issues I'd like to sort out.
>
> first thing is I can't seem to find the right ID in the CSS file for
> the text at the bottom of the search results (in dark purple) to
> change it to a more visible colour.
>
> The search results page doesn't show the code displaying the results
> at least when I view page source.
>
> Now when I search I get 3-5 results (depending on the search term)
> even using the code: searchControl.setResultSetSize
> (google.search.Search.LARGE_RESULTSET);
>
> when I click on "more results" a lot more results come up. I'd
> prefer to have them come on the search page rather than having to open
> in a new window/tab as happens when I click more results.
>
> The other thing I'd like to do use the code:
>
> search.setQueryAddition("filetype:html");
>
> to restrict results to html pages. I need to do this to stop bringing
> up results from some text files that are stored on the server.
>
> I tried adding it in but it seemed to break the script and nothing at
> all was displayed.
>
> thanks again,
>
> Chris Ross
>
> On May 14, 11:17 pm, Jeremy Geerdes <[email protected]> wrote:
>> Looking at your code, there are a couple of things that need to
>> happen. First, let's look at the JS part:
>>
>> You have google.load("search","1"); twice; you only need it once.
>>
>> To see more than one result at a time, before the line reading
>> searchControl.addSearcher(siteSearch); , add the following code:
>>
>> var options = new google.search.SearcherOptions;
>> options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
>>
>> If you would like to see 8 results at a time, you can also add the
>> following here, too:
>>
>> searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
>>
>> Then change the line reading searchControl.addSearcher(siteSearch);
>> to
>> the following:
>>
>> searchControl.addSearcher(siteSearch, options);
>>
>> As far as the CSS is concerned, you have a couple of options. The
>> first is that you could go through and add ".gsc-resultsRoot-
>> siteSearch " (with the space, without the quotations marks) to the
>> beginning of each selector you want to make sure gets applied to your
>> control. This will work, but considering that it appears as though
>> you've essentially copied the default.css file anyway, it may be
>> easier - and better performance-wise - to just exclude load the
>> Search
>> API without its default css and just provide your own. You can do
>> this
>> by changing the line reading google.load("search","1"); (remember,
>> you
>> only have one of these left!) to this:
>>
>> google.load("search","1",{"nocss":1});
>>
>> As noted, this should instruct the jsapi to load the Search API
>> WITHOUT its default css. So your css should be the only applicable
>> rules.
>>
>> Hope that helps!
>>
>> Jeremy R. Geerdes
>> Effective website design & development
>> Des Moines, IA
>>
>> For more information or a project quote:http://jgeerdes.home.mchsi.comhttp
>> ://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com
>> [email protected]
>>
>> Unless otherwise noted, any price quotes contained within this
>> communication are given in US dollars.
>>
>> If you're in the Des Moines, IA, area, check out Debra Heights
>> Wesleyan Church!
>>
>> And check out my blog, Adventures in Web Development,
>> athttp://jgeerdes.blogspot.com
>> !
>>
>> On May 14, 2009, at 7:13 AM, ChrisRoss wrote:
>>
>>
>>
>>> Hi I'm new to this group, don't have a huge amount of script
>>> knowledge, just cobble stuff together from examples I find. I've
>>> tried implementing a search for my website that is restricted to my
>>> website and I come across 2 problems.
>>
>>> First I can't get CSS styles I setup to work. I edited the css style
>>> file I found in the documentation and loaded it on my server and
>>> linked to it. I can't find clear directions on how to have the CSS
>>> styles apply to the output coming from the search.
>>
>>> Second I can't get the large search result to stick. I found this
>>> code:
>>
>>> var searchControl = new google.search.SearchControl();
>>> var searcher = new google.search.WebSearch();
>>> var options = new google.search.SearcherOptions();
>>> options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
>>> searchControl.addSearcher(searcher,options);
>>> searchControl.draw(document.getElementById('my_element');
>>
>>> placed it my search page but it appeared to make no difference at
>>> all.
>>
>>> What I want to have happen is to change font styles and colours as
>>> set
>>> in the CSS file and for at least 4 search results to show without
>>> having to click the small symbol at the top of the results.
>>
>>> The link to the search page is:
>>
>>> http://www.aus-natural.com/search.htm
>>
>>> It is restricted to my site only. To try it out typing "rose robin"
>>> will return at least 4 results if you click the show more results
>>> button.
>>
>>> Thanks in advance for any help.
>>
>>> regards,
>>
>>> Chris Ross
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google AJAX APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---