Due to limmited database I want to Disable CS Search and use Google Custom Search for my site instead. In Hawaii theme I tried to edit the master.master and remove the CS Search Code then paste the Google Search Code. However there was still some error. Any one please instruct me where to edit CS Code to use Googel Search for my site
Thank you,
In the masterpage don't remove the CS Search, just set the placehold to be invisible (Visible="false"). Then add your own code in.
Hawaii has the search box referenced on other master pages which is why you get the error.
Nick - nb development
Nick,
I have replaced the code but the google search didn't work on CS. When I press the Search button, the page only refresh and nothing happen.
This is because the google code uses a form. ASP.net uses the form for postback info.
So what you do is use javascript, and remove the form.
<input type="text" id="query" name="query" /><input type="button" value="Search" onclick="location.href='http://www.google.com/search?q=' + document.getElementById('query').value + ' site:yourdomainname.com';" />
I still get error, please tell me how to change this code:
<style type="text/css">@import url(http://www.google.com/cse/api/branding.css);</style><div class="cse-branding-bottom" style="background-color:#FFFFFF;color:#000000"> <div class="cse-branding-form"> <form action="http://edu.net.vn/search/SearchResults.aspx" id="cse-search-box"> <div> <input type="hidden" name="cx" value="partner-pub-4834229009304130:fszplsaxb11t" /> <input type="hidden" name="cof" value="FORID:10" /> <input type="hidden" name="ie" value="UTF-8" /> <input type="text" name="q" size="25" /> <input type="submit" name="sa" value="Search" /> </div> </form> </div> <div class="cse-branding-logo"> <img src="http://www.google.com/images/poweredby_transparent/poweredby_FFFFFF.gif" alt="Google" /> </div> <div class="cse-branding-text"> Custom Search</div>
Thank you very much!
I still get error. Please tell me how to change this code bellow:
<style type="text/css">@import url(http://www.google.com/cse/api/branding.css);</style><div class="cse-branding-bottom" style="background-color:#FFFFFF;color:#000000"> <div class="cse-branding-form"> <form action=".../search/SearchResults.aspx" id="cse-search-box"> <div> <input type="hidden" name="cx" value="partner-pub-4834229009304130:fszplsaxb10t" /> <input type="hidden" name="cof" value="FORID:10" /> <input type="hidden" name="ie" value="UTF-8" /> <input type="text" name="q" size="25" /> <input type="submit" name="sa" value="Search" /> </div> </form> </div> <div class="cse-branding-logo"> <img src="http://www.google.com/images/poweredby_transparent/poweredby_FFFFFF.gif" alt="Google" /> </div> <div class="cse-branding-text"> Custom Search</div>
Don't forget to remove the SearchBarrel stuff in communityserver_override.config too.
<Override xpath = "/CommunityServer/Tasks/Threads/Thread/task[@name='ForumsIndexing']" mode = "remove" /> <Override xpath = "/CommunityServer/Tasks/Threads/Thread/task[@name='WeblogIndexing']" mode = "remove" /> <Override xpath = "/CommunityServer/Tasks/Threads/Thread/task[@name='GalleryIndexing']" mode = "remove" /> <Override xpath = "/CommunityServer/Tasks/Threads/Thread/task[@name='FilesIndexing']" mode = "remove" /> <Override xpath = "/CommunityServer/SearchBarrel" mode = "remove" />
The UKs best resource for the Golf, Bora, Jetta and Scirocco
Audi Forums, Galleries and Blogs
Please chang this code to Javascript for me, I tried but the search still not works
<form action="http://www.google.com.vn/cse" id="cse-search-box"> <div> <input type="hidden" name="cx" value="partner-pub-4834229009304566:sn6gj8-9y5p" /> <input type="hidden" name="ie" value="UTF-8" /> <input type="text" name="q" size="31" /> <input type="submit" name="sa" value="Search" /> </div></form><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>
Please help me to change this code to javascript. I followed Nick instruction but the search still not working
<form action="http://www.google.com.vn/cse" id="cse-search-box"> <div> <input type="hidden" name="cx" value="partner-pub-4834229009304130:sn6gj8-9y5p" /> <input type="hidden" name="ie" value="UTF-8" /> <input type="text" name="q" size="31" /> <input type="submit" name="sa" value="Tìm kiếm" /> </div></form><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=vi"></script>
Thank to Nick and Dave Instruction I have replaced CS Search with Googe Search. However, I still facing some problems as follow:
<?xml version="1.0" encoding="utf-8" ?> <Overrides> <Override xpath = "/CommunityServer/Tasks/Threads/Thread/task[@name='ForumsIndexing']" mode = "remove" /> <Override xpath = "/CommunityServer/Tasks/Threads/Thread/task[@name='WeblogIndexing']" mode = "remove" /> <Override xpath = "/CommunityServer/Tasks/Threads/Thread/task[@name='MediaGalleryIndexing']" mode = "remove" /> <Override xpath = "/CommunityServer/Tasks/Threads/Thread/task[@name='HubIndexing']" mode = "remove" /> <Override xpath = "/CommunityServer/Tasks/Threads/Thread/task[@name='Emails']" mode = "remove" /> <Override xpath = "/CommunityServer/SearchBarrel" mode = "remove" /> </Overrides>
When I browse my site I got this error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
CommunityServer.Components.SearchBarrel.SearchBarrelProvider..cctor() +71
[TypeInitializationException: The type initializer for 'CommunityServer.Components.SearchBarrel.SearchBarrelProvider' threw an exception.]
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +268
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
CommunityServer.Components.SingletonProviderHelper.LoadInstance(String ProviderKey, Type defaultType) +81
CommunityServer.Components.SearchProvider..cctor() +13
[TypeInitializationException: The type initializer for 'CommunityServer.Components.SearchProvider' threw an exception.]
CommunityServer.Components.SearchProvider.Instance() +0
CommunityServer.Controls.SearchForm.DataBind() +61
CommunityServer.Controls.WrappedFormBase.OnLoad(EventArgs e) +25
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
Please help me to solve the problems
Thanks,
it make it capture the return button you'll need to search for "Javascript key events enter". It should tell you how to add an onkeydown function to the textbox to init the search
Please take a look and tell me what wrong which this code:
<!-- Search Google --> <CENTER> <SCRIPT language=JavaScript> </SCRIPT> <div align="center"> <input type="text" name="q" id="cse-search-box" size="25" /> <input type="button" name="sa" onclick="location.href='http://www.google.com.vn/cse?q=' + document.getElementById('cse-search-box').value + '&cx=partner-pub-4834229009304142:4a65sb-mewc&&ie=UTF-8';"function DetectEnterPressed(e) {var characterCodeif(e && e.which){ // NN4 specific codee = echaracterCode = e.which}else {e = eventcharacterCode = e.keyCode // IE specific code}if (characterCode == 13) return true // Enter key is 13else return false} value="Search" /> </div> </CENTER><!-- Search Google -->
I spent a lot of time trying to do the exact same thing and came up with a bit of a compromise. On all the pages that did not commit information to the database; I was able to replace the default <form> tag used by CS with the Google Form tag (keep runat="server" outta there!). On all other pages I placed a Google Search graphic that pushed users to the search page when clicked. You can achieve this through the use of multiple master pages, and so far I'm thinking it works pretty well.
Heya,
I've made my own SearchProvider by inheriting from SearchBarrelProvider in CommunityServer.Components.SearchBarrel in my own project, then changed the reference in communityserver.config thusly:
<!-- <add name = "SearchProvider" type = "CommunityServer.Components.SearchBarrel.SearchBarrelProvider, CommunityServer.Components.SearchBarrel" /> --> <add name = "SearchProvider" type = "HillsKBExtensions.HillsSearchBarrelProvider, HillsKBExtensions" />
Yes, I'm still using CommunityServer2007, but that's the best I have access to currently. Could someone tell me why I get the "Oops!" page, & see a record in the cs_exceptions with the following
Exception: System.Exception: Provider Type HillsKBExtensions.HillsSearchBarrelProvider, HillsKBExtensions could not be loaded at CommunityServer.Components.SingletonProviderHelper.LoadInstance(String ProviderKey, Type defaultType) at CommunityServer.Components.SearchProvider..cctor()
ExceptionMessage: The type initializer for 'CommunityServer.Components.SearchProvider' threw an exception.
So far, I've used this pattern of inheriting & replacing references in the communityserver.config, & it has worked. Additionally, from what I've learned/read, it's better to *not* modify the source, but make as many changes as possible in a separate project. This is the 1st time this has happened, & I can't figure why...
Help me, Obiwan Kenobi, you're my only hope...
- O8
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com