[R] Firefox keyword searches for R & S-Plus

Romain François francoisromain at free.fr
Sat Nov 13 13:35:40 CET 2004


Dear wizaRds, Kevin,

I came up with a solution to perform a r doc search in the Firefox 
search bar, you'll have to create a file called R.src in the search 
plugins directory  : (for me it is : C:/Program Files/Mozilla 
Firefox/searchplugins) and  put a png image of the R logo in the same 
directory (the logo has to be named R.png) : same prefix as the .src file.

My R.src file looks like that:

# Mozilla/R plug-in by francoisromain at free.fr

<search 
   name="R"
   description="R search engine"
   method="GET"
   action="file:///C:/Program%20Files/R/rw2000/doc/html/search/SearchObject.html"
>

<input name="SEARCHTERM" user>

<interpret 
    browserResultType="result" 
    charset = "UTF-8"
    resultListStart="<!--a-->" 
    resultListEnd="<!--z-->" 
    resultItemStart="<!--m-->" 
    resultItemEnd="<!--n-->"
>
</search>
#end of file


With only that the problem is that Firefox is calling the page

file:///C:/Program%20Files/R/rw2000/doc/html/search/SearchObject.html?_SEARCHTERM=_glm

if I want entries about glm. So the response is that

"No matches for " SEARCHTERM=glm " have been found 



I looked at several searchplugins but I think we can't get rid of the 
"SEARCHTERM=".

Then, I changed the searchObject.html file to remove that part of the 
searchstring, just after the commentary //call the applet code!, I just 
add that :

if(searchstring.length > 10 & searchstring.substring(0,10) == 'SEARCHTERM') { 
       searchstring = searchstring.substring(11,searchstring.length) ;
}



That works fine for me except that I don't get as much entries as the 
searchPluging.html gives : any ideas ?

Hope that will be helpfull for somebody else.

Romain.

> version
         _              
platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status                  
major    2              
minor    0.0            
year     2004           
month    10             
day      04             
language R 




kwright at eskimo.com a écrit :

>Nice idea.  A couple of comments.
>
>1. I personally always install R in c:/R/ instead of c:/Program Files/
>There are frequently comments on R-help that it is better to avoid paths
>with spaces.  Still, you should be able to use /Progra~1/ instead of
>/Program Files/
>
>2. The search engine plugin that you have created generates a URL like this:
>.../SearchObject.html?q=nlme
>
>What is needed is a URL like
>.../SearchObject.html?%s
>where the %s is the string from the text box.
>
>I speculate it might be possible to change the SearchObject.html file to
>grab the "q=nlme" and strip off the "q=" but I have no idea if this is
>possible.
>
>I'm not comfortable with HTML/Java/Javascript to get this working properly.
>
>3. My comment about editing the SearchObject.html file to change the
>"false" to "true" doesn't seem to cause the search to match the results
>obtained using the traditional way of opening the search page and typing
>in the text.
>I'm not sure why.  Would love it if someone figured this out.
>
>Seems like all of this would be fairly easy for a good web programmer.
>
>Kevin
>
>
>  
>
>>Hello Kevin,
>>
>>That's a good idea to use the functionnality of firefox to search for
>>help in R.
>>I wonder if that is possible to perform the search in the searchplugins
>>(like google), I tried to but there is always the characters %20= that
>>messed up with the one I was actually looking at.
>>Maybe something I don't see well, I created the following file in my
>>C:/Program Files/Mozilla Firefox/searchplugins directory (just copying
>>the google one)
>>
>>_____________________________________________________________________________________________
>># Mozilla/R plug-in by francoisromain at free.fr
>>
>><search
>>   name="R"
>>   description="R search engine"
>>   method="GET"
>>   action="file:///C:/Program%20Files/R/rw2000/doc/html/search/SearchObject.html"
>>    
>>
>><input name=" " user>
>>
>><interpret
>>    browserResultType="result"
>>    charset = "UTF-8"
>>    resultListStart="<!--a-->"
>>    resultListEnd="<!--z-->"
>>    resultItemStart="<!--m-->"
>>    resultItemEnd="<!--n-->"
>>    
>>
>></search>
>>_______________________________________________________________________________________________
>>
>>
>>Any idea ?
>>Sorry for my english.
>>
>>Romain.
>>
>>kwright at eskimo.com a écrit :
>>
>>    
>>
>>>If you've 'rediscovered the web' with Firefox (http://getfirefox.com),
>>>you
>>>might find this tip handy.  Suppose you want to search the (local) R
>>>documentation for information about the lme function.  Wouldn't it be
>>>nice
>>>to just type into the browser address bar:
>>> r lme
>>>and have the search performed?  Here's how (on Windows):
>>>
>>>Click on this link:
>>>file:///C:/Progra~1/rw2000/doc/html/search/SearchObject.html?%s
>>>
>>>Bookmark the page and name the bookmark something like: R 2.0.0 doc
>>>search
>>>
>>>Edit the properties of the bookmark (by right-clicking on the bookmark)
>>>and in the keywords field enter: r
>>>
>>>Click OK.
>>>
>>>
>>>That's all there is to it except for a couple of notes:
>>>
>>>1. The first time the local search is performed (during a browser
>>>session), the java search applet has to be loaded.  This takes several
>>>seconds.
>>>
>>>2. If you use a different operating system, a different version of R, or
>>>install R in a different location, change the bookmark path to the
>>>"SearchObject" file as appropriate.
>>>
>>>3. By default this only searches Help page titles.  You may prefer a more
>>>comprehensive search that includes Keywords and Object names.  Edit the
>>>SearchObject.html file and change 'false' to 'true' in the following
>>>line:
>>> line = line + document.SearchEngine.search
>>>(searchstring,true,true,true);
>>>
>>>
>>>
>>>Here are my R and S-Plus bookmarks.  I'll just give the link, my bookmark
>>>name, and my bookmark keyword.
>>>
>>>http://www.google.com/u/newcastlemaths?q=%s
>>>R mail archive search
>>>rh
>>>
>>>http://www.google.com/search?q=site:www.biostat.wustl.edu+[S]+%s
>>>S-news archive search
>>>sn
>>>
>>>file:///C:/Progra~1/rw2000/doc/html/search/SearchObject.html?%s
>>>R 2.0.0 doc search
>>>r
>>>
>>>
>>>Happy searching!
>>>
>>>Kevin Wright
>>>
>>>______________________________________________
>>>R-help at stat.math.ethz.ch mailing list
>>>https://stat.ethz.ch/mailman/listinfo/r-help
>>>PLEASE do read the posting guide!
>>>http://www.R-project.org/posting-guide.html
>>>
>>>
>>>
>>>
>>>      
>>>
>>--
>>Romain François
>>25, avenue Guy Moquet
>>94 400 Vitry sur seine
>>FRANCE
>>_______________________
>>_______________________
>>
>>francoisromain at free.fr
>>01 46 80 65 60
>>06 18 39 14 69
>>
>>
>>
>>    
>>
>
>
>
>  
>

-- 
Romain François
25, avenue Guy Moquet
94 400 Vitry sur seine
FRANCE
_______________________
_______________________

francoisromain at free.fr
01 46 80 65 60
06 18 39 14 69




More information about the R-help mailing list