DS-1217 Porting Discovery to the JSPUI

Contribution from CILEA funded by the Hub project from HKU
(http://hub.hku.hk)
Faceting, filtering (autocomplete), sidebar facet for the site home page,
community and collections are all implemented.
Changes to the Discovery API/configuration:
  1) changed the unique field for the SOLR document, now is used the
     concatenation of ID and TYPE-ID (in future we want to index also
     object that have not an handle)
  2) the prune query has been changed in search.resourcetype:[2 TO 4] so to          not remove eventually extra data loaded in the SOLR search core
  3) added defaultRpp parameter

Main differences from the XMLUI implementation:
  1) facets doesn't have a "...More" link but there are pagination to
     scroll facet in the context (search, home page, community, etc.)
  2) facets doesn't show the values already selected
  3) autocomplete is done against user input and does not dump all the
     values (this was a performance issue in XMLUI < 3.0, with 90k items
     I see JSON around 2Mb). With the new Discovery improvements the
     autocomplete feature in XMLUI seems to be turned off
  4) to enable JSPUI discovery you need to add some extra plugins in
     dspace.cfg (instructions are provided as comment in the discovery.cfg)
This commit is contained in:
Andrea Bollini
2012-09-13 12:31:23 +02:00
parent 21f93a34d4
commit 4fc8b9348b
66 changed files with 4616 additions and 682 deletions

View File

@@ -221,6 +221,24 @@ public class Item extends DSpaceObject
return new ItemIterator(context, rows);
}
/**
* Get all "final" items in the archive, both archived ("in archive" flag) or
* withdrawn items are included. The order of the list is indeterminate.
*
* @param context
* DSpace context object
* @return an iterator over the items in the archive.
* @throws SQLException
*/
public static ItemIterator findAllUnfiltered(Context context) throws SQLException
{
String myQuery = "SELECT * FROM item WHERE in_archive='1' or withdrawn='1'";
TableRowIterator rows = DatabaseManager.queryTable(context, "item", myQuery);
return new ItemIterator(context, rows);
}
/**
* Find all the items in the archive by a given submitter. The order is

View File

@@ -202,7 +202,7 @@ public class PluginManager
if (val == null)
{
log.warn("No Configuration entry found for Sequence Plugin interface="+iname);
return new Object[0];
return (Object[]) Array.newInstance(intfc, 0);
}
classname = val.trim().split("\\s*,\\s*");
sequenceConfig.put(iname, classname);

View File

@@ -0,0 +1,45 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.plugin;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Item;
import org.dspace.core.Context;
/**
* Interface that must be implemented by any plugin wanting to be called at the
* inception of the Item page (in HandleServlet). Classes that
* implement the process method and appear in the configuration will be run
* before the at the start of preparing the item home page has any chance
* to continue its execution. <b>Note that the plugin is executed also before
* than the READ permission on the item is checked</b>
*
* @author Andrea Bollini
*
*/
public interface ItemHomeProcessor
{
/**
* execute the process
*
* @param context the DSpace context
* @param request the HTTP request
* @param response the HTTP response
* @param item the item object whose home page we are on
*
* @throws PluginException any particular problem with the plugin execution
* @throws AuthorizeException Authorisation errors during plugin execution
*/
void process(Context context, HttpServletRequest request,
HttpServletResponse response, Item item)
throws PluginException, AuthorizeException;
}

View File

@@ -0,0 +1,42 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.plugin;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.dspace.authorize.AuthorizeException;
import org.dspace.core.Context;
/**
* Interface that must be implemented by any plugin wanting to be called at the
* inception of the Site home page (in index.jsp "welcome servlet"). Classes that
* implement the process method and appear in the configuration will be run
* before the at the start of preparing the home page has any chance
* to continue its execution
*
* @author Andrea Bollini
*
*/
public interface SiteHomeProcessor
{
/**
* execute the process
*
* @param context the DSpace context
* @param request the HTTP request
* @param response the HTTP response
*
* @throws PluginException any particular problem with the plugin execution
* @throws AuthorizeException Authorisation errors during plugin execution
*/
void process(Context context, HttpServletRequest request,
HttpServletResponse response)
throws PluginException, AuthorizeException;
}

View File

@@ -10,6 +10,7 @@ package org.dspace.search;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@@ -115,6 +116,9 @@ public class DSQuery
try
{
// calculate execution time
Date startTime = new Date();
// grab a searcher, and do the search
IndexSearcher searcher = getSearcher(c);
@@ -133,7 +137,11 @@ public class DSQuery
Query myquery = qp.parse(querystring);
//Retrieve enough docs to get all the results we need !
TopDocs hits = performQuery(args, searcher, myquery, args.getPageSize() * (args.getStart() + 1));
Date endTime = new Date();
qr.setQueryTime(endTime.getTime() - startTime.getTime());
// set total number of hits
qr.setHitCount(hits.totalHits);

View File

@@ -18,6 +18,8 @@ import org.dspace.core.ConfigurationManager;
*/
public class QueryResults
{
private long queryTime; // time to search (ms)
private int hitCount; // total hits returned by search engine
private int start; // offset of query 'page'
@@ -34,6 +36,16 @@ public class QueryResults
/** number of metadata elements to display before truncating using "et al" */
private int etAl = ConfigurationManager.getIntProperty("webui.itemlist.author-limit");
public long getQueryTime()
{
return queryTime;
}
public void setQueryTime(long queryTime)
{
this.queryTime = queryTime;
}
/**
* @return the number of metadata fields at which to truncate with "et al"
*/