How can I implement the Autocomplete function

Jul 24, 2009 at 1:56 AM

Just like the title to say.How can I implement the autocomplete function in the query box?

Jul 24, 2009 at 7:37 AM

Just Download latest source code. You will get what you want has your title say.

 

Reg,

Thiwanka

Aug 3, 2009 at 11:13 AM

Even I have this requirement to implement,  I have downloaded the source code last year and did lot of changes as per our requirement, on downloading latest version, the changes which I did in local machine will go off right?...can you tell me , what is the optimized method to upgrade my existing code?

 

 

Aug 3, 2009 at 5:10 PM

Yes. If you download latest source all your changes will discard. So what you have to do is,figure out changes between your version and last committed version and do update your source code according to that.

As I know following are the few changes between first version and last version

1.Auto Complete Proxy

2. Custom JS Files

3. Auto Complete Search Box.

 

Aug 4, 2009 at 6:42 AM

I have downloaded the latest source code.But,I didn't see the Autocomplete code with JS Files.And then,I have implemented one version to do that.

Follow is part code.

I use the wafer's JS code like follow:       

        protected override void OnPreRender(object sender, EventArgs e)
        {
            StringBuilder imageHover = new StringBuilder();

             imageHover.Append("<script language=\"javascript\"");
            imageHover.Append(" src=\"/wpresources/FastScr/prototype.js\">");
            imageHover.Append("</script>\n");

            imageHover.Append("<script language=\"javascript\"");
            imageHover.Append(" src=\"/wpresources/FastScr/scriptaculous.js\">");
            imageHover.Append("</script>\n");

            string szJsRegisterID = "{BA50BEEF-7E44-4b5f-B226-F66B1E6C3379}";
            if (!Page.ClientScript.IsClientScriptBlockRegistered(szJsRegisterID))
                Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(),szJsRegisterID, imageHover.ToString());

            Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "MyScript", " new Ajax.Autocompleter('" + m_searchKeyWordTextBox.ClientID + "', 'query_auto_complete', 'http://wsdemo:8080/wafer/queryCompletion', {'method': 'get'})", true);

            if (SearchResultPageURL != null && SearchResultPageURL.EndsWith("OSSSearchResults.aspx"))
            {
                SearchResultPageURL = Page.Request.Url.LocalPath;
            }
            base.OnPreRender(sender, e);
        }

        protected override void RenderContents(HtmlTextWriter writer)
        {
            base.RenderContents(writer);

            writer.WriteLine("<div class='searchBox' >");
            writer.WriteLine("<div class='auto_complete' id='query_auto_complete'></div>");
            writer.WriteLine("</div>");

        }

Oh.almost forget.

I change the source code in the prototype.js file.

         params = Hash.toQueryString(params);

        var myparams = params.split("=");

        params = "query=" + myparams[1];

        if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_='

and in the /wpresources/FastScr/ directory.there need 5 files:

controls.js     effects.js    prototype.js     scriptaculous.js   style.css

and then. everything is OK.

 

Oct 6, 2009 at 6:01 AM

I downloaded latest webparts and added Autocomplete webpart to the search page.

Auto complete is not working. However with the same installaiton of ESP, the autocomplete works on SFE (Search Front End).

What and where should I configure?

Am I missing something?

Mallikarjun

Oct 6, 2009 at 1:24 PM

Check what is return by your AutoCompleteProxy. It is located at  http://searchsite/_layouts/AutoCompleteProxy/AutoCompleteProxy.aspx?q=something

Oct 7, 2009 at 9:17 AM

It returns nothinfg (blank page).

I tried following

-          Change “…-f javascript…” to “…-f xml…” in the nodeconf.xml.

still no luck?

 

 

Nov 13, 2009 at 5:27 PM
mtuppad wrote:

It returns nothinfg (blank page).

I tried following

-          Change “…-f javascript…” to “…-f xml…” in the nodeconf.xml.

still no luck?

 

 

Have you update QRServer and Port in web.config ?

Also check whether your query competition server working or not. By default its running on port 15200