Search This Blog

Saturday, March 14, 2009

Using the Scopus API - 4: How to configure your Scopus search feature.

In the last post I put together a search form that would search the Scopus database for research published by people based at a single university. In this post I will look at the way the form is composed and the javascript that processes the query and its results.
The HTML Form

<form id="scapiForm" name="scapiForm" onsubmit="return false">
<legend>De Montfort University Research in Scopus</legend>
<label for="searchString">Search for:</label>
<input id="searchString" name="searchString" value="" type="text"> e.g. <i>Sparrows</i>
<label for="searchType">As a:</label>
<select id="searchType" size="1">
<option value="TITLE-ABS-KEY" selected="selected">Keyword</option>
<option value="AUTH">Author</option>
<option value="TITLE">Title</option>
<option value="SRCTITLE">Journal</option>
voption value="DOI">DOI</option>
<label for="dateSearchType">Published:</label>
<select id="dateSearchType" size="1">
<option value="BEF" selected="selected">Before</option>
<option value="IS">Exactly</option>
<option value="AFT">After</option>
<label for="dateSearchYear">Year:</label>
<input maxlength="4" size="4" id="dateSearchYear" value="2009" type="text">
<label for="sortType">Sort results by:</label>
<select id="sortType" size="1">
<option value="Date" selected="selected">Date</option>
<option value="CitedByCount">Citations</option>
<option value="Authors">Author A-Z</option>
<label for="kludge"></label>
<button id="kludge" onclick="runSearch2()" name="searchButton" class="btn"



My customised Scopus search form has some of the advanced search features built into it. You can change then way the results come back from date order to 'cited by'. This would bring back the most influential results (if a count of the number of other articles citing it is an indicator of such influence).
The Javascript

<script type="text/javascript">
<!-- SECTION 2 : Call back -->
callback = function(){ document.scapiForm.searchButton.disabled = false; }
<!-- SECTION 3 : Running Search -->

runSearch2 = function()
document.scapiForm.searchButton.disabled = true;
var varSearchObj = new searchObj();
var terms = document.scapiForm.searchString.value;
var mytype = document.scapiForm.searchType.value;
var myop = document.scapiForm.dateSearchType.value;
var myyear = document.scapiForm.dateSearchYear.value;
var myterms = ""+mytype+"(\""+terms+"\") and AF-ID(\"60017098\") and PUBYEAR "+myop+" "+myyear+ "";
var mysort = document.scapiForm.sortType.value;


<!-- SECTION 4 : Setting defaults -->
<script type="text/javascript">
scapi.setDeveloperID("--INSERT YOUR DEVELOPER ID HERE--");

I have renamed the function to 'runSearch2' to avoid mucking up the way it worked on the earlier example.
"var terms = document.scapiForm.searchString.value;" captures whatever you typed into the searchbox and puts it into a variable called 'terms'.
"var mytype = document.scapiForm.searchType.value;" captures the type of search you intend (or at least selected) from the keyword, author, title, journal, doi options. Again, it created a variable called 'mytype' that I can use later.
De Montfort University has a Scopus Affiliation ID number of 60017098. I found this by using the Affiliation Search tab in Scopus.
With these variables I can make:
var myterms = ""+mytype+"(\""+terms+"\") and AF-ID(\"60017098\")
'myterms' uses '\' to escape the quotes and '+' to insert the variables. It needs to look, as far as Scopus is concerned, like a genuinely well-formed Advanced search query. It then becomes the argument in the setSearch bit of the varSearchObj object.
In turn this becomes the argument in
There are other options to be selected, captured and added to the search object. I have not asked for abstracts for the search results, but if I wanted to I could add them to the list of required fields in varSearchObj.setFields.
Displaying the results
So far I have been configuring the search options. But I should be possible to change the way the results are presented. I have not had much success yet in doing this, so if you are able to get better results, I would be interested to learn how. For example, Tom wanted to include links to the full text for the items in the search results. That would require reformatting the results into an openurl and embedding the openurl into the display.

Thursday, March 12, 2009

Using the Scopus API - 3: An Advanced search feature

If you just wanted a simple search box for Scopus, as in part 1, your users may as well log in to Scopus and search for themselves. Once you see what the Advanced Search features might be able to do, you may want to design a feature for your own website to make it easy for your users to find information, without having to compose their own elegant searches.
For example:

De Montfort University Research in Scopus

e.g. Sparrows

The results are restricted to items published by researchers based at De Montfort University.