[Mediawiki-l] Ajax Search Suggest (my first extension)

Jim Hu jimhu at tamu.edu
Sat Mar 1 16:45:06 UTC 2008


Now that I have it sort of working... I'm testing in Safari and  
Firefox both on a mac.

I see the suggestions in the area under the search box, which I think  
is what the code is doing.  This would be nicer as a drop-down menu  
from the search box.

The suggestions that come up for me are weird.  For example I type x  
and get page titles that don't have x in them!

puzzling.  I think the sql query looks reasonable based on the  
extension code.

Jim


On Mar 1, 2008, at 10:31 AM, Jim Hu wrote:

> I made the changes on the code at mediawiki.org.
>
> In general, I might wait to trigger the search until more characters
> have been entered.  1 seems like overkill; how useful will the
> suggestions be when you type 'e'?
>
> In Firefox, the browser's autocomplete tries to run, and sits on top
> of what the extension is doing.  I wonder if that can be suppressed.
>
> Jim
>
> On Mar 1, 2008, at 10:22 AM, Jim Hu wrote:
>
>> function wfAjaxSetSearchSuggestHeaders($outputPage) {
>>>>      global $wgJsMimeType, $wgStylePath,$wgScriptPath;
>>        $outputPage->addLink(
>>                array(
>>                        'rel' => 'stylesheet',
>>                        'type' => 'text/css',
>>>>                      'href' => $wgScriptPath.'/extensions/
>> searchsuggest/style.css'
>>                )
>>        );
>>>>      $outputPage->addScript( "<script type=\"{$wgJsMimeType}\"
>> src=\"$wgScriptPath/extensions/searchsuggest/searchsuggest.js\">"."</
>> script>\n");
>>        $outputPage->addScript( "<script type=\"{$wgJsMimeType}
>> \">hookEvent(\"load\", ss_ajax_onload);</script>\n" );
>> }
>>
>> On Mar 1, 2008, at 10:10 AM, Jim Hu wrote:
>>
>>> I'm having similar problems.  I think there's a path problem in
>>> setting the header, and the js file isn't loading. Playing with it
>>> now.
>>>
>>> Jim
>>>
>>> On Mar 1, 2008, at 9:53 AM, Adam Meyer wrote:
>>>
>>>> Hmmm... Im not sure why that is.
>>>> In the javascript file, do you see the ss_ajax_onload function??
>>>>
>>>> -Adam
>>>>
>>>> On Mar 1, 2008, at 10:30 AM, Grietinus Koops wrote:
>>>>
>>>>> Adam,
>>>>> Excellent! I only don't get it working for some reason...
>>>>> There's an error "ss_ajax_onload is not defined" if I look in the
>>>>> script
>>>>> errors... Any idea? I use MW1.10
>>>>> Grietinus
>>>>>
>>>>> 2008/3/1, Adam Meyer <meyer7 at mindspring.com>:
>>>>>>
>>>>>> I just finished my first extension. It needs work I know, but
>>>>>> perhaps
>>>>>> anyone looking for something like this can use it and let me know
>>>>>> what
>>>>>> it needs.
>>>>>>
>>>>>> It is a very lightweight search suggestion. (under 5k). When
>>>>>> typing
>>>>>> into the search box, articles containing those letters or word
>>>>>> will
>>>>>> be
>>>>>> displayed under the search bar.
>>>>>>
>>>>>> http://www.mediawiki.org/wiki/Extension:Search_Suggest
>>>>>>
>>>>>> Thank you to everyone who helped make this work.
>>>>>> If you would like to help make this better, I would really love
>>>>>> any
>>>>>> help.
>>>>>> I would like to be able to select what you want to choose using
>>>>>> the
>>>>>> arrow keys.
>>>>>>
>>>>>> Also, I could easily make the suggestions links so anyone could
>>>>>> just
>>>>>> click on them.
>>>>>>
>>>>>> _______________________________________________
>>>>>> MediaWiki-l mailing list
>>>>>> MediaWiki-l at lists.wikimedia.org
>>>>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>>>>>
>>>>> _______________________________________________
>>>>> MediaWiki-l mailing list
>>>>> MediaWiki-l at lists.wikimedia.org
>>>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>>>
>>>>
>>>> _______________________________________________
>>>> MediaWiki-l mailing list
>>>> MediaWiki-l at lists.wikimedia.org
>>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>>
>>> =====================================
>>> Jim Hu
>>> Associate Professor
>>> Dept. of Biochemistry and Biophysics
>>> 2128 TAMU
>>> Texas A&M Univ.
>>> College Station, TX 77843-2128
>>> 979-862-4054
>>>
>>>
>>> _______________________________________________
>>> MediaWiki-l mailing list
>>> MediaWiki-l at lists.wikimedia.org
>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>
>> =====================================
>> Jim Hu
>> Associate Professor
>> Dept. of Biochemistry and Biophysics
>> 2128 TAMU
>> Texas A&M Univ.
>> College Station, TX 77843-2128
>> 979-862-4054
>>
>>
>> _______________________________________________
>> MediaWiki-l mailing list
>> MediaWiki-l at lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
> =====================================
> Jim Hu
> Associate Professor
> Dept. of Biochemistry and Biophysics
> 2128 TAMU
> Texas A&M Univ.
> College Station, TX 77843-2128
> 979-862-4054
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

=====================================
Jim Hu
Associate Professor
Dept. of Biochemistry and Biophysics
2128 TAMU
Texas A&M Univ.
College Station, TX 77843-2128
979-862-4054




More information about the MediaWiki-l mailing list