mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 05:53:08 +00:00
DS-4166 community feedback: rename BrowsableObject to IndexableObject
This commit is contained in:
@@ -22,7 +22,7 @@ import com.sun.syndication.feed.module.opensearch.impl.OpenSearchModuleImpl;
|
|||||||
import com.sun.syndication.io.FeedException;
|
import com.sun.syndication.io.FeedException;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dspace.app.util.service.OpenSearchService;
|
import org.dspace.app.util.service.OpenSearchService;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
@@ -119,7 +119,7 @@ public class OpenSearchServiceImpl implements OpenSearchService {
|
|||||||
@Override
|
@Override
|
||||||
public String getResultsString(Context context, String format, String query, int totalResults, int start,
|
public String getResultsString(Context context, String format, String query, int totalResults, int start,
|
||||||
int pageSize,
|
int pageSize,
|
||||||
DSpaceObject scope, List<BrowsableObject> results,
|
DSpaceObject scope, List<IndexableObject> results,
|
||||||
Map<String, String> labels) throws IOException {
|
Map<String, String> labels) throws IOException {
|
||||||
try {
|
try {
|
||||||
return getResults(context, format, query, totalResults, start, pageSize, scope, results, labels)
|
return getResults(context, format, query, totalResults, start, pageSize, scope, results, labels)
|
||||||
@@ -133,7 +133,7 @@ public class OpenSearchServiceImpl implements OpenSearchService {
|
|||||||
@Override
|
@Override
|
||||||
public Document getResultsDoc(Context context, String format, String query, int totalResults, int start,
|
public Document getResultsDoc(Context context, String format, String query, int totalResults, int start,
|
||||||
int pageSize,
|
int pageSize,
|
||||||
DSpaceObject scope, List<BrowsableObject> results, Map<String, String> labels)
|
DSpaceObject scope, List<IndexableObject> results, Map<String, String> labels)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
try {
|
try {
|
||||||
return getResults(context, format, query, totalResults, start, pageSize, scope, results, labels)
|
return getResults(context, format, query, totalResults, start, pageSize, scope, results, labels)
|
||||||
@@ -146,7 +146,7 @@ public class OpenSearchServiceImpl implements OpenSearchService {
|
|||||||
|
|
||||||
protected SyndicationFeed getResults(Context context, String format, String query, int totalResults, int start,
|
protected SyndicationFeed getResults(Context context, String format, String query, int totalResults, int start,
|
||||||
int pageSize, DSpaceObject scope,
|
int pageSize, DSpaceObject scope,
|
||||||
List<BrowsableObject> results, Map<String, String> labels) {
|
List<IndexableObject> results, Map<String, String> labels) {
|
||||||
// Encode results in requested format
|
// Encode results in requested format
|
||||||
if ("rss".equals(format)) {
|
if ("rss".equals(format)) {
|
||||||
format = "rss_2.0";
|
format = "rss_2.0";
|
||||||
|
@@ -37,7 +37,7 @@ import com.sun.syndication.io.SyndFeedOutput;
|
|||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Bitstream;
|
import org.dspace.content.Bitstream;
|
||||||
import org.dspace.content.Bundle;
|
import org.dspace.content.Bundle;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
@@ -185,7 +185,7 @@ public class SyndicationFeed {
|
|||||||
* @param labels label map
|
* @param labels label map
|
||||||
*/
|
*/
|
||||||
public void populate(HttpServletRequest request, Context context, DSpaceObject dso,
|
public void populate(HttpServletRequest request, Context context, DSpaceObject dso,
|
||||||
List<BrowsableObject> items, Map<String, String> labels) {
|
List<IndexableObject> items, Map<String, String> labels) {
|
||||||
String logoURL = null;
|
String logoURL = null;
|
||||||
String objectURL = null;
|
String objectURL = null;
|
||||||
String defaultTitle = null;
|
String defaultTitle = null;
|
||||||
@@ -248,11 +248,11 @@ public class SyndicationFeed {
|
|||||||
// add entries for items
|
// add entries for items
|
||||||
if (items != null) {
|
if (items != null) {
|
||||||
List<SyndEntry> entries = new ArrayList<SyndEntry>();
|
List<SyndEntry> entries = new ArrayList<SyndEntry>();
|
||||||
for (BrowsableObject itemDSO : items) {
|
for (IndexableObject idxObj : items) {
|
||||||
if (itemDSO.getType() != Constants.ITEM) {
|
if (idxObj.getType() != Constants.ITEM) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Item item = (Item) itemDSO;
|
Item item = (Item) idxObj;
|
||||||
boolean hasDate = false;
|
boolean hasDate = false;
|
||||||
SyndEntry entry = new SyndEntryImpl();
|
SyndEntry entry = new SyndEntryImpl();
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
|
@@ -12,7 +12,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@@ -92,7 +92,7 @@ public interface OpenSearchService {
|
|||||||
*/
|
*/
|
||||||
public String getResultsString(Context context, String format, String query, int totalResults, int start,
|
public String getResultsString(Context context, String format, String query, int totalResults, int start,
|
||||||
int pageSize,
|
int pageSize,
|
||||||
DSpaceObject scope, List<BrowsableObject> results,
|
DSpaceObject scope, List<IndexableObject> results,
|
||||||
Map<String, String> labels) throws IOException;
|
Map<String, String> labels) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,7 +112,7 @@ public interface OpenSearchService {
|
|||||||
*/
|
*/
|
||||||
public Document getResultsDoc(Context context, String format, String query, int totalResults, int start,
|
public Document getResultsDoc(Context context, String format, String query, int totalResults, int start,
|
||||||
int pageSize,
|
int pageSize,
|
||||||
DSpaceObject scope, List<BrowsableObject> results, Map<String, String> labels)
|
DSpaceObject scope, List<IndexableObject> results, Map<String, String> labels)
|
||||||
throws IOException;
|
throws IOException;
|
||||||
|
|
||||||
public DSpaceObject resolveScope(Context context, String scope) throws SQLException;
|
public DSpaceObject resolveScope(Context context, String scope) throws SQLException;
|
||||||
|
@@ -133,7 +133,7 @@ public class BrowserScope {
|
|||||||
* @param dso the container object; a Community or Collection
|
* @param dso the container object; a Community or Collection
|
||||||
* @throws BrowseException if browse error
|
* @throws BrowseException if browse error
|
||||||
*/
|
*/
|
||||||
public void setBrowseContainer(BrowsableObject dso)
|
public void setBrowseContainer(IndexableObject dso)
|
||||||
throws BrowseException {
|
throws BrowseException {
|
||||||
if (dso instanceof Collection) {
|
if (dso instanceof Collection) {
|
||||||
this.collection = (Collection) dso;
|
this.collection = (Collection) dso;
|
||||||
|
@@ -12,14 +12,14 @@ import java.io.Serializable;
|
|||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the basic interface that a data model entity need to implement to support browsing/retrieval
|
* This is the basic interface that a data model entity need to implement to be indexable in Discover
|
||||||
*
|
*
|
||||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||||
*
|
*
|
||||||
* @param <PK>
|
* @param <PK>
|
||||||
* the Class of the primary key
|
* the Class of the primary key
|
||||||
*/
|
*/
|
||||||
public interface BrowsableObject<PK extends Serializable> {
|
public interface IndexableObject<PK extends Serializable> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@@ -307,7 +307,7 @@ public class SolrBrowseDAO implements BrowseDAO {
|
|||||||
DiscoverResult resp = getSolrResponse();
|
DiscoverResult resp = getSolrResponse();
|
||||||
|
|
||||||
List<Item> bitems = new ArrayList<>();
|
List<Item> bitems = new ArrayList<>();
|
||||||
for (BrowsableObject<UUID> solrDoc : resp.getDspaceObjects()) {
|
for (IndexableObject<UUID> solrDoc : resp.getIndexableObjects()) {
|
||||||
// FIXME introduce project, don't retrieve Item immediately when
|
// FIXME introduce project, don't retrieve Item immediately when
|
||||||
// processing the query...
|
// processing the query...
|
||||||
Item item = (Item) solrDoc;
|
Item item = (Item) solrDoc;
|
||||||
@@ -331,7 +331,7 @@ public class SolrBrowseDAO implements BrowseDAO {
|
|||||||
}
|
}
|
||||||
if (resp.getTotalSearchResults() > 0) {
|
if (resp.getTotalSearchResults() > 0) {
|
||||||
SearchDocument doc = resp.getSearchDocument(
|
SearchDocument doc = resp.getSearchDocument(
|
||||||
resp.getDspaceObjects().get(0)).get(0);
|
resp.getIndexableObjects().get(0)).get(0);
|
||||||
return (String) doc.getSearchFieldValues(column).get(0);
|
return (String) doc.getSearchFieldValues(column).get(0);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@@ -26,7 +26,7 @@ import javax.persistence.Transient;
|
|||||||
|
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.dspace.authorize.ResourcePolicy;
|
import org.dspace.authorize.ResourcePolicy;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.ReloadableEntity;
|
import org.dspace.core.ReloadableEntity;
|
||||||
import org.dspace.handle.Handle;
|
import org.dspace.handle.Handle;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
@@ -38,7 +38,7 @@ import org.hibernate.annotations.GenericGenerator;
|
|||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
@Table(name = "dspaceobject")
|
@Table(name = "dspaceobject")
|
||||||
public abstract class DSpaceObject implements Serializable, ReloadableEntity<java.util.UUID>,
|
public abstract class DSpaceObject implements Serializable, ReloadableEntity<java.util.UUID>,
|
||||||
BrowsableObject<UUID> {
|
IndexableObject<UUID> {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(generator = "system-uuid")
|
@GeneratedValue(generator = "system-uuid")
|
||||||
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
|
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
|
||||||
|
@@ -11,7 +11,7 @@ import java.io.Serializable;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.eperson.EPerson;
|
import org.dspace.eperson.EPerson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +21,7 @@ import org.dspace.eperson.EPerson;
|
|||||||
* @author Robert Tansley
|
* @author Robert Tansley
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public interface InProgressSubmission<ID extends Serializable> extends BrowsableObject<ID> {
|
public interface InProgressSubmission<ID extends Serializable> extends IndexableObject<ID> {
|
||||||
/**
|
/**
|
||||||
* Get the internal ID of this submission
|
* Get the internal ID of this submission
|
||||||
*
|
*
|
||||||
|
@@ -28,7 +28,7 @@ import javax.persistence.Table;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
@@ -47,7 +47,7 @@ import org.hibernate.proxy.HibernateProxyHelper;
|
|||||||
@Entity
|
@Entity
|
||||||
@Table(name = "workspaceitem")
|
@Table(name = "workspaceitem")
|
||||||
public class WorkspaceItem
|
public class WorkspaceItem
|
||||||
implements InProgressSubmission<Integer>, Serializable, ReloadableEntity<Integer>, BrowsableObject<Integer> {
|
implements InProgressSubmission<Integer>, Serializable, ReloadableEntity<Integer>, IndexableObject<Integer> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "workspace_item_id", unique = true, nullable = false)
|
@Column(name = "workspace_item_id", unique = true, nullable = false)
|
||||||
|
@@ -10,19 +10,19 @@ package org.dspace.content.factory;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.content.InProgressSubmission;
|
import org.dspace.content.InProgressSubmission;
|
||||||
import org.dspace.content.WorkspaceItem;
|
import org.dspace.content.WorkspaceItem;
|
||||||
import org.dspace.content.service.BitstreamFormatService;
|
import org.dspace.content.service.BitstreamFormatService;
|
||||||
import org.dspace.content.service.BitstreamService;
|
import org.dspace.content.service.BitstreamService;
|
||||||
import org.dspace.content.service.BrowsableObjectService;
|
|
||||||
import org.dspace.content.service.BundleService;
|
import org.dspace.content.service.BundleService;
|
||||||
import org.dspace.content.service.CollectionService;
|
import org.dspace.content.service.CollectionService;
|
||||||
import org.dspace.content.service.CommunityService;
|
import org.dspace.content.service.CommunityService;
|
||||||
import org.dspace.content.service.DSpaceObjectLegacySupportService;
|
import org.dspace.content.service.DSpaceObjectLegacySupportService;
|
||||||
import org.dspace.content.service.DSpaceObjectService;
|
import org.dspace.content.service.DSpaceObjectService;
|
||||||
import org.dspace.content.service.InProgressSubmissionService;
|
import org.dspace.content.service.InProgressSubmissionService;
|
||||||
|
import org.dspace.content.service.IndexableObjectService;
|
||||||
import org.dspace.content.service.InstallItemService;
|
import org.dspace.content.service.InstallItemService;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
import org.dspace.content.service.MetadataFieldService;
|
import org.dspace.content.service.MetadataFieldService;
|
||||||
@@ -42,7 +42,12 @@ import org.dspace.workflow.factory.WorkflowServiceFactory;
|
|||||||
*/
|
*/
|
||||||
public abstract class ContentServiceFactory {
|
public abstract class ContentServiceFactory {
|
||||||
|
|
||||||
public abstract List<BrowsableObjectService> getBrowsableObjectServices();
|
/**
|
||||||
|
* Return the list of all the available implementation of the IndexableObjectService interface
|
||||||
|
*
|
||||||
|
* @return the list of IndexableObjectService
|
||||||
|
*/
|
||||||
|
public abstract List<IndexableObjectService> getIndexableObjectServices();
|
||||||
|
|
||||||
public abstract List<DSpaceObjectService<? extends DSpaceObject>> getDSpaceObjectServices();
|
public abstract List<DSpaceObjectService<? extends DSpaceObject>> getDSpaceObjectServices();
|
||||||
|
|
||||||
@@ -103,12 +108,12 @@ public abstract class ContentServiceFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends BrowsableObject<PK>, PK extends Serializable> BrowsableObjectService<T, PK>
|
public <T extends IndexableObject<PK>, PK extends Serializable> IndexableObjectService<T, PK>
|
||||||
getBrowsableObjectService(int type) {
|
getIndexableObjectService(int type) {
|
||||||
for (int i = 0; i < getBrowsableObjectServices().size(); i++) {
|
for (int i = 0; i < getIndexableObjectServices().size(); i++) {
|
||||||
BrowsableObjectService objectService = getBrowsableObjectServices().get(i);
|
IndexableObjectService objectService = getIndexableObjectServices().get(i);
|
||||||
if (objectService.getSupportsTypeConstant() == type) {
|
if (objectService.getSupportsTypeConstant() == type) {
|
||||||
return (BrowsableObjectService<T, PK>) objectService;
|
return (IndexableObjectService<T, PK>) objectService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new UnsupportedOperationException("Unknown Browsable DSpace type: " + type);
|
throw new UnsupportedOperationException("Unknown Browsable DSpace type: " + type);
|
||||||
|
@@ -12,12 +12,12 @@ import java.util.List;
|
|||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.content.service.BitstreamFormatService;
|
import org.dspace.content.service.BitstreamFormatService;
|
||||||
import org.dspace.content.service.BitstreamService;
|
import org.dspace.content.service.BitstreamService;
|
||||||
import org.dspace.content.service.BrowsableObjectService;
|
|
||||||
import org.dspace.content.service.BundleService;
|
import org.dspace.content.service.BundleService;
|
||||||
import org.dspace.content.service.CollectionService;
|
import org.dspace.content.service.CollectionService;
|
||||||
import org.dspace.content.service.CommunityService;
|
import org.dspace.content.service.CommunityService;
|
||||||
import org.dspace.content.service.DSpaceObjectLegacySupportService;
|
import org.dspace.content.service.DSpaceObjectLegacySupportService;
|
||||||
import org.dspace.content.service.DSpaceObjectService;
|
import org.dspace.content.service.DSpaceObjectService;
|
||||||
|
import org.dspace.content.service.IndexableObjectService;
|
||||||
import org.dspace.content.service.InstallItemService;
|
import org.dspace.content.service.InstallItemService;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
import org.dspace.content.service.MetadataFieldService;
|
import org.dspace.content.service.MetadataFieldService;
|
||||||
@@ -70,8 +70,8 @@ public class ContentServiceFactoryImpl extends ContentServiceFactory {
|
|||||||
private SiteService siteService;
|
private SiteService siteService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BrowsableObjectService> getBrowsableObjectServices() {
|
public List<IndexableObjectService> getIndexableObjectServices() {
|
||||||
return new DSpace().getServiceManager().getServicesByType(BrowsableObjectService.class);
|
return new DSpace().getServiceManager().getServicesByType(IndexableObjectService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -28,7 +28,7 @@ import org.dspace.core.Context;
|
|||||||
* @param <T> class type
|
* @param <T> class type
|
||||||
* @author kevinvandevelde at atmire.com
|
* @author kevinvandevelde at atmire.com
|
||||||
*/
|
*/
|
||||||
public interface DSpaceObjectService<T extends DSpaceObject> extends BrowsableObjectService<T, UUID> {
|
public interface DSpaceObjectService<T extends DSpaceObject> extends IndexableObjectService<T, UUID> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a proper name for the object. This may return <code>null</code>.
|
* Get a proper name for the object. This may return <code>null</code>.
|
||||||
|
@@ -26,7 +26,7 @@ import org.dspace.core.Context;
|
|||||||
* @author kevinvandevelde at atmire.com
|
* @author kevinvandevelde at atmire.com
|
||||||
*/
|
*/
|
||||||
public interface InProgressSubmissionService<T extends InProgressSubmission<ID>, ID extends Serializable>
|
public interface InProgressSubmissionService<T extends InProgressSubmission<ID>, ID extends Serializable>
|
||||||
extends BrowsableObjectService<T, ID> {
|
extends IndexableObjectService<T, ID> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes submission wrapper, doesn't delete item contents
|
* Deletes submission wrapper, doesn't delete item contents
|
||||||
|
@@ -10,23 +10,22 @@ package org.dspace.content.service;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service interface class for any BrowsableObject.
|
* Service interface class for any IndexableObject.
|
||||||
* All BrowsableObject service classes should implement this class since it offers some basic methods which all
|
* All IndexableObject service classes should implement this class since it offers some basic methods which all
|
||||||
* BrowsableObjects are required to have.
|
* IndexableObjects are required to have.
|
||||||
*
|
*
|
||||||
* @param <T> class type
|
* @param <T> class type
|
||||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||||
*/
|
*/
|
||||||
public interface BrowsableObjectService<T extends BrowsableObject<PK>, PK extends Serializable> {
|
public interface IndexableObjectService<T extends IndexableObject<PK>, PK extends Serializable> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic find for when the precise type of a BDSO is not known, just the
|
* Generic find for when the precise type of an IndexableObject is not known
|
||||||
* a pair of type number and database ID.
|
|
||||||
*
|
*
|
||||||
* @param context - the context
|
* @param context - the context
|
||||||
* @param id - id within table of type'd objects
|
* @param id - id within table of type'd objects
|
||||||
@@ -38,7 +37,7 @@ public interface BrowsableObjectService<T extends BrowsableObject<PK>, PK extend
|
|||||||
/**
|
/**
|
||||||
* Returns the Constants which this service supports
|
* Returns the Constants which this service supports
|
||||||
*
|
*
|
||||||
* @return a org.dspace.core.Constants that represents a BrowsableObject type
|
* @return a org.dspace.core.Constants that represents a IndexableObject type
|
||||||
*/
|
*/
|
||||||
public int getSupportsTypeConstant();
|
public int getSupportsTypeConstant();
|
||||||
}
|
}
|
@@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.discovery.configuration.DiscoveryConfigurationParameters;
|
import org.dspace.discovery.configuration.DiscoveryConfigurationParameters;
|
||||||
import org.dspace.discovery.configuration.DiscoverySearchFilterFacet;
|
import org.dspace.discovery.configuration.DiscoverySearchFilterFacet;
|
||||||
|
|
||||||
@@ -28,35 +28,35 @@ public class DiscoverResult {
|
|||||||
|
|
||||||
private long totalSearchResults;
|
private long totalSearchResults;
|
||||||
private int start;
|
private int start;
|
||||||
private List<BrowsableObject> dspaceObjects;
|
private List<IndexableObject> indexableObjects;
|
||||||
private Map<String, List<FacetResult>> facetResults;
|
private Map<String, List<FacetResult>> facetResults;
|
||||||
private Map<String, List<FacetResult>> facetQueryResults;
|
private Map<String, List<FacetResult>> facetQueryResults;
|
||||||
private Map<String, List<FacetResult>> facetFieldResults;
|
private Map<String, List<FacetResult>> facetFieldResults;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A map that contains all the documents sougth after, the key is a string representation of the DSpace object
|
* A map that contains all the documents sougth after, the key is a string representation of the Indexable Object
|
||||||
*/
|
*/
|
||||||
private Map<String, List<SearchDocument>> searchDocuments;
|
private Map<String, List<SearchDocument>> searchDocuments;
|
||||||
private int maxResults = -1;
|
private int maxResults = -1;
|
||||||
private int searchTime;
|
private int searchTime;
|
||||||
private Map<String, DSpaceObjectHighlightResult> highlightedResults;
|
private Map<String, IndexableObjectHighlightResult> highlightedResults;
|
||||||
private String spellCheckQuery;
|
private String spellCheckQuery;
|
||||||
|
|
||||||
public DiscoverResult() {
|
public DiscoverResult() {
|
||||||
dspaceObjects = new ArrayList<BrowsableObject>();
|
indexableObjects = new ArrayList<IndexableObject>();
|
||||||
facetResults = new LinkedHashMap<String, List<FacetResult>>();
|
facetResults = new LinkedHashMap<String, List<FacetResult>>();
|
||||||
facetQueryResults = new LinkedHashMap<String, List<FacetResult>>();
|
facetQueryResults = new LinkedHashMap<String, List<FacetResult>>();
|
||||||
facetFieldResults = new LinkedHashMap<String, List<FacetResult>>();
|
facetFieldResults = new LinkedHashMap<String, List<FacetResult>>();
|
||||||
searchDocuments = new LinkedHashMap<String, List<SearchDocument>>();
|
searchDocuments = new LinkedHashMap<String, List<SearchDocument>>();
|
||||||
highlightedResults = new HashMap<String, DSpaceObjectHighlightResult>();
|
highlightedResults = new HashMap<String, IndexableObjectHighlightResult>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDSpaceObject(BrowsableObject dso) {
|
public void addIndexableObject(IndexableObject idxObj) {
|
||||||
this.dspaceObjects.add(dso);
|
this.indexableObjects.add(idxObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BrowsableObject> getDspaceObjects() {
|
public List<IndexableObject> getIndexableObjects() {
|
||||||
return dspaceObjects;
|
return indexableObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTotalSearchResults() {
|
public long getTotalSearchResults() {
|
||||||
@@ -151,11 +151,11 @@ public class DiscoverResult {
|
|||||||
return ListUtils.emptyIfNull(facetValues);
|
return ListUtils.emptyIfNull(facetValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DSpaceObjectHighlightResult getHighlightedResults(BrowsableObject dso) {
|
public IndexableObjectHighlightResult getHighlightedResults(IndexableObject dso) {
|
||||||
return highlightedResults.get(dso.getUniqueIndexID());
|
return highlightedResults.get(dso.getUniqueIndexID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHighlightedResult(BrowsableObject dso, DSpaceObjectHighlightResult highlightedResult) {
|
public void addHighlightedResult(IndexableObject dso, IndexableObjectHighlightResult highlightedResult) {
|
||||||
this.highlightedResults.put(dso.getUniqueIndexID(), highlightedResult);
|
this.highlightedResults.put(dso.getUniqueIndexID(), highlightedResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,20 +218,20 @@ public class DiscoverResult {
|
|||||||
this.spellCheckQuery = spellCheckQuery;
|
this.spellCheckQuery = spellCheckQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class DSpaceObjectHighlightResult {
|
public static final class IndexableObjectHighlightResult {
|
||||||
private BrowsableObject dso;
|
private IndexableObject indexableObject;
|
||||||
private Map<String, List<String>> highlightResults;
|
private Map<String, List<String>> highlightResults;
|
||||||
private Map<String, List<String[]>> highlightResultsWithAuthority;
|
private Map<String, List<String[]>> highlightResultsWithAuthority;
|
||||||
|
|
||||||
public DSpaceObjectHighlightResult(BrowsableObject dso, Map<String, List<String>> highlightResults,
|
public IndexableObjectHighlightResult(IndexableObject idxObj, Map<String, List<String>> highlightResults,
|
||||||
Map<String, List<String[]>> highlightResultsWithAuthority) {
|
Map<String, List<String[]>> highlightResultsWithAuthority) {
|
||||||
this.dso = dso;
|
this.indexableObject = idxObj;
|
||||||
this.highlightResults = highlightResults;
|
this.highlightResults = highlightResults;
|
||||||
this.highlightResultsWithAuthority = highlightResultsWithAuthority;
|
this.highlightResultsWithAuthority = highlightResultsWithAuthority;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BrowsableObject getDso() {
|
public IndexableObject getIndexableObject() {
|
||||||
return dso;
|
return indexableObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getHighlightResults(String metadataKey) {
|
public List<String> getHighlightResults(String metadataKey) {
|
||||||
@@ -247,8 +247,8 @@ public class DiscoverResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSearchDocument(BrowsableObject dso, SearchDocument searchDocument) {
|
public void addSearchDocument(IndexableObject dso, SearchDocument searchDocument) {
|
||||||
String dsoString = SearchDocument.getDspaceObjectStringRepresentation(dso);
|
String dsoString = SearchDocument.getIndexableObjectStringRepresentation(dso);
|
||||||
List<SearchDocument> docs = searchDocuments.get(dsoString);
|
List<SearchDocument> docs = searchDocuments.get(dsoString);
|
||||||
if (docs == null) {
|
if (docs == null) {
|
||||||
docs = new ArrayList<SearchDocument>();
|
docs = new ArrayList<SearchDocument>();
|
||||||
@@ -260,12 +260,12 @@ public class DiscoverResult {
|
|||||||
/**
|
/**
|
||||||
* Returns all the sought after search document values
|
* Returns all the sought after search document values
|
||||||
*
|
*
|
||||||
* @param dso
|
* @param idxObj
|
||||||
* the dspace object we want our search documents for
|
* the indexable object we want our search documents for
|
||||||
* @return the search documents list
|
* @return the search documents list
|
||||||
*/
|
*/
|
||||||
public List<SearchDocument> getSearchDocument(BrowsableObject dso) {
|
public List<SearchDocument> getSearchDocument(IndexableObject idxObj) {
|
||||||
String dsoString = SearchDocument.getDspaceObjectStringRepresentation(dso);
|
String dsoString = SearchDocument.getIndexableObjectStringRepresentation(idxObj);
|
||||||
List<SearchDocument> result = searchDocuments.get(dsoString);
|
List<SearchDocument> result = searchDocuments.get(dsoString);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return new ArrayList<SearchDocument>();
|
return new ArrayList<SearchDocument>();
|
||||||
@@ -305,8 +305,8 @@ public class DiscoverResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDspaceObjectStringRepresentation(BrowsableObject dso) {
|
public static String getIndexableObjectStringRepresentation(IndexableObject idxObj) {
|
||||||
return dso.getType() + ":" + dso.getID();
|
return idxObj.getType() + ":" + idxObj.getID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.discovery.configuration.DiscoverySearchFilterFacet;
|
import org.dspace.discovery.configuration.DiscoverySearchFilterFacet;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class FacetYearRange {
|
|||||||
return oldestYear != -1 && newestYear != -1;
|
return oldestYear != -1 && newestYear != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculateRange(Context context, List<String> filterQueries, BrowsableObject scope,
|
public void calculateRange(Context context, List<String> filterQueries, IndexableObject scope,
|
||||||
SearchService searchService, DiscoverQuery parentQuery) throws SearchServiceException {
|
SearchService searchService, DiscoverQuery parentQuery) throws SearchServiceException {
|
||||||
dateFacet = facet.getIndexFieldName() + ".year";
|
dateFacet = facet.getIndexFieldName() + ".year";
|
||||||
//Get a range query so we can create facet queries ranging from our first to our last date
|
//Get a range query so we can create facet queries ranging from our first to our last date
|
||||||
@@ -94,7 +94,7 @@ public class FacetYearRange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void calculateNewRangeBasedOnSearchIndex(Context context, List<String> filterQueries,
|
private void calculateNewRangeBasedOnSearchIndex(Context context, List<String> filterQueries,
|
||||||
BrowsableObject scope, SearchService searchService,
|
IndexableObject scope, SearchService searchService,
|
||||||
DiscoverQuery parentQuery) throws SearchServiceException {
|
DiscoverQuery parentQuery) throws SearchServiceException {
|
||||||
DiscoverQuery yearRangeQuery = new DiscoverQuery();
|
DiscoverQuery yearRangeQuery = new DiscoverQuery();
|
||||||
yearRangeQuery.setDiscoveryConfigurationName(parentQuery.getDiscoveryConfigurationName());
|
yearRangeQuery.setDiscoveryConfigurationName(parentQuery.getDiscoveryConfigurationName());
|
||||||
@@ -107,9 +107,9 @@ public class FacetYearRange {
|
|||||||
yearRangeQuery.addSearchField(dateFacet);
|
yearRangeQuery.addSearchField(dateFacet);
|
||||||
DiscoverResult lastYearResult = searchService.search(context, scope, yearRangeQuery);
|
DiscoverResult lastYearResult = searchService.search(context, scope, yearRangeQuery);
|
||||||
|
|
||||||
if (0 < lastYearResult.getDspaceObjects().size()) {
|
if (0 < lastYearResult.getIndexableObjects().size()) {
|
||||||
List<DiscoverResult.SearchDocument> searchDocuments = lastYearResult
|
List<DiscoverResult.SearchDocument> searchDocuments = lastYearResult
|
||||||
.getSearchDocument(lastYearResult.getDspaceObjects().get(0));
|
.getSearchDocument(lastYearResult.getIndexableObjects().get(0));
|
||||||
if (0 < searchDocuments.size() && 0 < searchDocuments.get(0).getSearchFieldValues(dateFacet).size()) {
|
if (0 < searchDocuments.size() && 0 < searchDocuments.get(0).getSearchFieldValues(dateFacet).size()) {
|
||||||
oldestYear = Integer.parseInt(searchDocuments.get(0).getSearchFieldValues(dateFacet).get(0));
|
oldestYear = Integer.parseInt(searchDocuments.get(0).getSearchFieldValues(dateFacet).get(0));
|
||||||
}
|
}
|
||||||
@@ -117,9 +117,9 @@ public class FacetYearRange {
|
|||||||
//Now get the first year
|
//Now get the first year
|
||||||
yearRangeQuery.setSortField(dateFacet + "_sort", DiscoverQuery.SORT_ORDER.desc);
|
yearRangeQuery.setSortField(dateFacet + "_sort", DiscoverQuery.SORT_ORDER.desc);
|
||||||
DiscoverResult firstYearResult = searchService.search(context, scope, yearRangeQuery);
|
DiscoverResult firstYearResult = searchService.search(context, scope, yearRangeQuery);
|
||||||
if (0 < firstYearResult.getDspaceObjects().size()) {
|
if (0 < firstYearResult.getIndexableObjects().size()) {
|
||||||
List<DiscoverResult.SearchDocument> searchDocuments = firstYearResult
|
List<DiscoverResult.SearchDocument> searchDocuments = firstYearResult
|
||||||
.getSearchDocument(firstYearResult.getDspaceObjects().get(0));
|
.getSearchDocument(firstYearResult.getIndexableObjects().get(0));
|
||||||
if (0 < searchDocuments.size() && 0 < searchDocuments.get(0).getSearchFieldValues(dateFacet).size()) {
|
if (0 < searchDocuments.size() && 0 < searchDocuments.get(0).getSearchFieldValues(dateFacet).size()) {
|
||||||
newestYear = Integer.parseInt(searchDocuments.get(0).getSearchFieldValues(dateFacet).get(0));
|
newestYear = Integer.parseInt(searchDocuments.get(0).getSearchFieldValues(dateFacet).get(0));
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ import org.apache.commons.cli.OptionBuilder;
|
|||||||
import org.apache.commons.cli.Options;
|
import org.apache.commons.cli.Options;
|
||||||
import org.apache.commons.cli.PosixParser;
|
import org.apache.commons.cli.PosixParser;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.Community;
|
import org.dspace.content.Community;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
@@ -177,7 +177,7 @@ public class IndexClient {
|
|||||||
String[] identifiers = optionValue.split("\\s*,\\s*");
|
String[] identifiers = optionValue.split("\\s*,\\s*");
|
||||||
for (String id : identifiers) {
|
for (String id : identifiers) {
|
||||||
if (id.startsWith(ConfigurationManager.getProperty("handle.prefix")) || id.startsWith("123456789/")) {
|
if (id.startsWith(ConfigurationManager.getProperty("handle.prefix")) || id.startsWith("123456789/")) {
|
||||||
BrowsableObject dso = (BrowsableObject) HandleServiceFactory.getInstance()
|
IndexableObject dso = (IndexableObject) HandleServiceFactory.getInstance()
|
||||||
.getHandleService().resolveToObject(context, id);
|
.getHandleService().resolveToObject(context, id);
|
||||||
indexer.indexContent(context, dso, line.hasOption("f"));
|
indexer.indexContent(context, dso, line.hasOption("f"));
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ public class IndexClient {
|
|||||||
}
|
}
|
||||||
} else if (line.hasOption('i')) {
|
} else if (line.hasOption('i')) {
|
||||||
final String handle = line.getOptionValue('i');
|
final String handle = line.getOptionValue('i');
|
||||||
final BrowsableObject dso = (BrowsableObject) HandleServiceFactory.getInstance()
|
final IndexableObject dso = (IndexableObject) HandleServiceFactory.getInstance()
|
||||||
.getHandleService().resolveToObject(context, handle);
|
.getHandleService().resolveToObject(context, handle);
|
||||||
if (dso == null) {
|
if (dso == null) {
|
||||||
throw new IllegalArgumentException("Cannot resolve " + handle + " to a DSpace object");
|
throw new IllegalArgumentException("Cannot resolve " + handle + " to a DSpace object");
|
||||||
@@ -249,7 +249,7 @@ public class IndexClient {
|
|||||||
private static long indexAll(final IndexingService indexingService,
|
private static long indexAll(final IndexingService indexingService,
|
||||||
final ItemService itemService,
|
final ItemService itemService,
|
||||||
final Context context,
|
final Context context,
|
||||||
final BrowsableObject dso)
|
final IndexableObject dso)
|
||||||
throws IOException, SearchServiceException, SQLException {
|
throws IOException, SearchServiceException, SQLException {
|
||||||
long count = 0;
|
long count = 0;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Bundle;
|
import org.dspace.content.Bundle;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
@@ -34,7 +34,7 @@ public class IndexEventConsumer implements Consumer {
|
|||||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(IndexEventConsumer.class);
|
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(IndexEventConsumer.class);
|
||||||
|
|
||||||
// collect Items, Collections, Communities that need indexing
|
// collect Items, Collections, Communities that need indexing
|
||||||
private Set<BrowsableObject> objectsToUpdate = null;
|
private Set<IndexableObject> objectsToUpdate = null;
|
||||||
|
|
||||||
// unique search IDs to delete
|
// unique search IDs to delete
|
||||||
private Set<String> uniqueIdsToDelete = null;
|
private Set<String> uniqueIdsToDelete = null;
|
||||||
@@ -59,7 +59,7 @@ public class IndexEventConsumer implements Consumer {
|
|||||||
public void consume(Context ctx, Event event) throws Exception {
|
public void consume(Context ctx, Event event) throws Exception {
|
||||||
|
|
||||||
if (objectsToUpdate == null) {
|
if (objectsToUpdate == null) {
|
||||||
objectsToUpdate = new HashSet<BrowsableObject>();
|
objectsToUpdate = new HashSet<IndexableObject>();
|
||||||
uniqueIdsToDelete = new HashSet<String>();
|
uniqueIdsToDelete = new HashSet<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ public class IndexEventConsumer implements Consumer {
|
|||||||
+ ", perhaps it has been deleted.");
|
+ ", perhaps it has been deleted.");
|
||||||
} else {
|
} else {
|
||||||
log.debug("consume() adding event to update queue: " + event.toString());
|
log.debug("consume() adding event to update queue: " + event.toString());
|
||||||
objectsToUpdate.add((BrowsableObject)subject);
|
objectsToUpdate.add((IndexableObject)subject);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ public class IndexEventConsumer implements Consumer {
|
|||||||
+ ", perhaps it has been deleted.");
|
+ ", perhaps it has been deleted.");
|
||||||
} else {
|
} else {
|
||||||
log.debug("consume() adding event to update queue: " + event.toString());
|
log.debug("consume() adding event to update queue: " + event.toString());
|
||||||
objectsToUpdate.add((BrowsableObject)object);
|
objectsToUpdate.add((IndexableObject)object);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ public class IndexEventConsumer implements Consumer {
|
|||||||
if (objectsToUpdate != null && uniqueIdsToDelete != null) {
|
if (objectsToUpdate != null && uniqueIdsToDelete != null) {
|
||||||
|
|
||||||
// update the changed Items not deleted because they were on create list
|
// update the changed Items not deleted because they were on create list
|
||||||
for (BrowsableObject iu : objectsToUpdate) {
|
for (IndexableObject iu : objectsToUpdate) {
|
||||||
/* we let all types through here and
|
/* we let all types through here and
|
||||||
* allow the search indexer to make
|
* allow the search indexer to make
|
||||||
* decisions on indexing and/or removal
|
* decisions on indexing and/or removal
|
||||||
|
@@ -12,7 +12,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,19 +24,19 @@ import org.dspace.core.Context;
|
|||||||
*/
|
*/
|
||||||
public interface IndexingService {
|
public interface IndexingService {
|
||||||
|
|
||||||
void indexContent(Context context, BrowsableObject dso)
|
void indexContent(Context context, IndexableObject dso)
|
||||||
throws SQLException;
|
throws SQLException;
|
||||||
|
|
||||||
void indexContent(Context context, BrowsableObject dso,
|
void indexContent(Context context, IndexableObject dso,
|
||||||
boolean force) throws SQLException;
|
boolean force) throws SQLException;
|
||||||
|
|
||||||
void indexContent(Context context, BrowsableObject dso,
|
void indexContent(Context context, IndexableObject dso,
|
||||||
boolean force, boolean commit) throws SQLException, SearchServiceException;
|
boolean force, boolean commit) throws SQLException, SearchServiceException;
|
||||||
|
|
||||||
void unIndexContent(Context context, BrowsableObject dso)
|
void unIndexContent(Context context, IndexableObject dso)
|
||||||
throws SQLException, IOException;
|
throws SQLException, IOException;
|
||||||
|
|
||||||
void unIndexContent(Context context, BrowsableObject dso, boolean commit)
|
void unIndexContent(Context context, IndexableObject dso, boolean commit)
|
||||||
throws SQLException, IOException;
|
throws SQLException, IOException;
|
||||||
|
|
||||||
void unIndexContent(Context context, String uniqueSearchID)
|
void unIndexContent(Context context, String uniqueSearchID)
|
||||||
@@ -45,7 +45,7 @@ public interface IndexingService {
|
|||||||
void unIndexContent(Context context, String uniqueSearchID, boolean commit)
|
void unIndexContent(Context context, String uniqueSearchID, boolean commit)
|
||||||
throws IOException;
|
throws IOException;
|
||||||
|
|
||||||
void reIndexContent(Context context, BrowsableObject dso)
|
void reIndexContent(Context context, IndexableObject dso)
|
||||||
throws SQLException, IOException;
|
throws SQLException, IOException;
|
||||||
|
|
||||||
void createIndex(Context context) throws SQLException, IOException;
|
void createIndex(Context context) throws SQLException, IOException;
|
||||||
|
@@ -10,7 +10,7 @@ package org.dspace.discovery;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.discovery.configuration.DiscoveryMoreLikeThisConfiguration;
|
import org.dspace.discovery.configuration.DiscoveryMoreLikeThisConfiguration;
|
||||||
@@ -49,7 +49,7 @@ public interface SearchService {
|
|||||||
* @return discovery search result object
|
* @return discovery search result object
|
||||||
* @throws SearchServiceException if search error
|
* @throws SearchServiceException if search error
|
||||||
*/
|
*/
|
||||||
DiscoverResult search(Context context, BrowsableObject dso, DiscoverQuery query)
|
DiscoverResult search(Context context, IndexableObject dso, DiscoverQuery query)
|
||||||
throws SearchServiceException;
|
throws SearchServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,10 +73,10 @@ public interface SearchService {
|
|||||||
* @return discovery search result object
|
* @return discovery search result object
|
||||||
* @throws SearchServiceException if search error
|
* @throws SearchServiceException if search error
|
||||||
*/
|
*/
|
||||||
DiscoverResult search(Context context, BrowsableObject dso, DiscoverQuery query, boolean includeWithdrawn)
|
DiscoverResult search(Context context, IndexableObject dso, DiscoverQuery query, boolean includeWithdrawn)
|
||||||
throws SearchServiceException;
|
throws SearchServiceException;
|
||||||
|
|
||||||
List<BrowsableObject> search(Context context, String query, String orderfield, boolean ascending, int offset,
|
List<IndexableObject> search(Context context, String query, String orderfield, boolean ascending, int offset,
|
||||||
int max, String... filterquery);
|
int max, String... filterquery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,7 +129,7 @@ public interface SearchService {
|
|||||||
*/
|
*/
|
||||||
String escapeQueryChars(String query);
|
String escapeQueryChars(String query);
|
||||||
|
|
||||||
FacetYearRange getFacetYearRange(Context context, BrowsableObject scope, DiscoverySearchFilterFacet facet,
|
FacetYearRange getFacetYearRange(Context context, IndexableObject scope, DiscoverySearchFilterFacet facet,
|
||||||
List<String> filterQueries, DiscoverQuery parentQuery)
|
List<String> filterQueries, DiscoverQuery parentQuery)
|
||||||
throws SearchServiceException;
|
throws SearchServiceException;
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ package org.dspace.discovery;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Bitstream;
|
import org.dspace.content.Bitstream;
|
||||||
import org.dspace.content.Bundle;
|
import org.dspace.content.Bundle;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
@@ -30,7 +30,7 @@ import org.dspace.core.Context;
|
|||||||
public class SolrServiceContentInOriginalBundleFilterPlugin implements SolrServiceIndexPlugin {
|
public class SolrServiceContentInOriginalBundleFilterPlugin implements SolrServiceIndexPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void additionalIndex(Context context, BrowsableObject dso, SolrInputDocument document) {
|
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document) {
|
||||||
if (dso instanceof Item) {
|
if (dso instanceof Item) {
|
||||||
Item item = (Item) dso;
|
Item item = (Item) dso;
|
||||||
boolean hasOriginalBundleWithContent = hasOriginalBundleWithContent(item);
|
boolean hasOriginalBundleWithContent = hasOriginalBundleWithContent(item);
|
||||||
|
@@ -10,7 +10,7 @@ package org.dspace.discovery;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Bitstream;
|
import org.dspace.content.Bitstream;
|
||||||
import org.dspace.content.Bundle;
|
import org.dspace.content.Bundle;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
@@ -41,7 +41,7 @@ public class SolrServiceFileInfoPlugin implements SolrServiceIndexPlugin {
|
|||||||
private static final String SOLR_FIELD_NAME_FOR_DESCRIPTIONS = "original_bundle_descriptions";
|
private static final String SOLR_FIELD_NAME_FOR_DESCRIPTIONS = "original_bundle_descriptions";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void additionalIndex(Context context, BrowsableObject dso, SolrInputDocument document) {
|
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document) {
|
||||||
if (dso instanceof Item) {
|
if (dso instanceof Item) {
|
||||||
Item item = (Item) dso;
|
Item item = (Item) dso;
|
||||||
List<Bundle> bundles = item.getBundles();
|
List<Bundle> bundles = item.getBundles();
|
||||||
|
@@ -69,7 +69,7 @@ import org.apache.solr.handler.extraction.ExtractingParams;
|
|||||||
import org.dspace.app.util.Util;
|
import org.dspace.app.util.Util;
|
||||||
import org.dspace.authorize.ResourcePolicy;
|
import org.dspace.authorize.ResourcePolicy;
|
||||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.Community;
|
import org.dspace.content.Community;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
@@ -244,7 +244,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
* @throws SQLException if error
|
* @throws SQLException if error
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void indexContent(Context context, BrowsableObject dso)
|
public void indexContent(Context context, IndexableObject dso)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
indexContent(context, dso, false);
|
indexContent(context, dso, false);
|
||||||
}
|
}
|
||||||
@@ -260,7 +260,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
* @throws SQLException if error
|
* @throws SQLException if error
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void indexContent(Context context, BrowsableObject dso,
|
public void indexContent(Context context, IndexableObject dso,
|
||||||
boolean force) throws SQLException {
|
boolean force) throws SQLException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -320,7 +320,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
* @throws IOException if IO error
|
* @throws IOException if IO error
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void unIndexContent(Context context, BrowsableObject dso)
|
public void unIndexContent(Context context, IndexableObject dso)
|
||||||
throws SQLException, IOException {
|
throws SQLException, IOException {
|
||||||
unIndexContent(context, dso, false);
|
unIndexContent(context, dso, false);
|
||||||
}
|
}
|
||||||
@@ -335,7 +335,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
* @throws IOException if IO error
|
* @throws IOException if IO error
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void unIndexContent(Context context, BrowsableObject dso, boolean commit)
|
public void unIndexContent(Context context, IndexableObject dso, boolean commit)
|
||||||
throws SQLException, IOException {
|
throws SQLException, IOException {
|
||||||
try {
|
try {
|
||||||
if (dso == null) {
|
if (dso == null) {
|
||||||
@@ -401,7 +401,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
* @param dso object to re-index
|
* @param dso object to re-index
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void reIndexContent(Context context, BrowsableObject dso)
|
public void reIndexContent(Context context, IndexableObject dso)
|
||||||
throws SQLException, IOException {
|
throws SQLException, IOException {
|
||||||
try {
|
try {
|
||||||
indexContent(context, dso);
|
indexContent(context, dso);
|
||||||
@@ -591,7 +591,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
|
|
||||||
String uniqueID = (String) doc.getFieldValue(RESOURCE_UNIQUE_ID);
|
String uniqueID = (String) doc.getFieldValue(RESOURCE_UNIQUE_ID);
|
||||||
|
|
||||||
BrowsableObject o = findDSpaceObject(context, doc);
|
IndexableObject o = findIndexableObject(context, doc);
|
||||||
|
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
log.info("Deleting: " + uniqueID);
|
log.info("Deleting: " + uniqueID);
|
||||||
@@ -1869,14 +1869,14 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DiscoverResult search(Context context, BrowsableObject dso,
|
public DiscoverResult search(Context context, IndexableObject dso,
|
||||||
DiscoverQuery query)
|
DiscoverQuery query)
|
||||||
throws SearchServiceException {
|
throws SearchServiceException {
|
||||||
return search(context, dso, query, false);
|
return search(context, dso, query, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DiscoverResult search(Context context, BrowsableObject dso, DiscoverQuery discoveryQuery,
|
public DiscoverResult search(Context context, IndexableObject dso, DiscoverQuery discoveryQuery,
|
||||||
boolean includeUnDiscoverable) throws SearchServiceException {
|
boolean includeUnDiscoverable) throws SearchServiceException {
|
||||||
if (dso != null) {
|
if (dso != null) {
|
||||||
if (dso instanceof Community) {
|
if (dso instanceof Community) {
|
||||||
@@ -2054,10 +2054,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
|
|
||||||
List<String> searchFields = query.getSearchFields();
|
List<String> searchFields = query.getSearchFields();
|
||||||
for (SolrDocument doc : solrQueryResponse.getResults()) {
|
for (SolrDocument doc : solrQueryResponse.getResults()) {
|
||||||
BrowsableObject dso = findDSpaceObject(context, doc);
|
IndexableObject dso = findIndexableObject(context, doc);
|
||||||
|
|
||||||
if (dso != null) {
|
if (dso != null) {
|
||||||
result.addDSpaceObject(dso);
|
result.addIndexableObject(dso);
|
||||||
} else {
|
} else {
|
||||||
log.error(LogManager.getHeader(context, "Error while retrieving DSpace object from discovery index",
|
log.error(LogManager.getHeader(context, "Error while retrieving DSpace object from discovery index",
|
||||||
"Handle: " + doc.getFirstValue(HANDLE_FIELD)));
|
"Handle: " + doc.getFirstValue(HANDLE_FIELD)));
|
||||||
@@ -2096,7 +2096,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
result.addHighlightedResult(dso,
|
result.addHighlightedResult(dso,
|
||||||
new DiscoverResult.DSpaceObjectHighlightResult(dso, resultMap, resultMapWithAuthority));
|
new DiscoverResult.IndexableObjectHighlightResult(dso, resultMap, resultMapWithAuthority));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2197,18 +2197,18 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find DSpace object by type and UUID or by handle from given Solr document
|
* Find the indexable object by type and UUID
|
||||||
*
|
*
|
||||||
* @param context The relevant DSpace Context.
|
* @param context The relevant DSpace Context.
|
||||||
* @param doc the solr document
|
* @param doc the solr document
|
||||||
* @return DSpace object
|
* @return an IndexableObject
|
||||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||||
*/
|
*/
|
||||||
protected BrowsableObject findDSpaceObject(Context context, SolrDocument doc) throws SQLException {
|
protected IndexableObject findIndexableObject(Context context, SolrDocument doc) throws SQLException {
|
||||||
Integer type = (Integer) doc.getFirstValue(RESOURCE_TYPE_FIELD);
|
Integer type = (Integer) doc.getFirstValue(RESOURCE_TYPE_FIELD);
|
||||||
Object id = doc.getFirstValue(RESOURCE_ID_FIELD);
|
Object id = doc.getFirstValue(RESOURCE_ID_FIELD);
|
||||||
String handle = (String) doc.getFirstValue(HANDLE_FIELD);
|
String handle = (String) doc.getFirstValue(HANDLE_FIELD);
|
||||||
BrowsableObject o = null;
|
IndexableObject o = null;
|
||||||
Serializable uid = null;
|
Serializable uid = null;
|
||||||
if (type != null && id != null) {
|
if (type != null && id != null) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -2225,7 +2225,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uid != null) {
|
if (uid != null) {
|
||||||
o = (BrowsableObject) contentServiceFactory.getBrowsableObjectService(type).find(context, uid);
|
o = (IndexableObject) contentServiceFactory.getIndexableObjectService(type).find(context, uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
@@ -2235,13 +2235,13 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BrowsableObject> search(Context context, String query, int offset, int max,
|
public List<IndexableObject> search(Context context, String query, int offset, int max,
|
||||||
String... filterquery) {
|
String... filterquery) {
|
||||||
return search(context, query, null, true, offset, max, filterquery);
|
return search(context, query, null, true, offset, max, filterquery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BrowsableObject> search(Context context, String query, String orderfield, boolean ascending,
|
public List<IndexableObject> search(Context context, String query, String orderfield, boolean ascending,
|
||||||
int offset, int max, String... filterquery) {
|
int offset, int max, String... filterquery) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -2265,12 +2265,12 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
SolrDocumentList docs = rsp.getResults();
|
SolrDocumentList docs = rsp.getResults();
|
||||||
|
|
||||||
Iterator iter = docs.iterator();
|
Iterator iter = docs.iterator();
|
||||||
List<BrowsableObject> result = new ArrayList<BrowsableObject>();
|
List<IndexableObject> result = new ArrayList<IndexableObject>();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
SolrDocument doc = (SolrDocument) iter.next();
|
SolrDocument doc = (SolrDocument) iter.next();
|
||||||
|
|
||||||
BrowsableObject o = (BrowsableObject)contentServiceFactory
|
IndexableObject o = (IndexableObject)contentServiceFactory
|
||||||
.getBrowsableObjectService((Integer) doc.getFirstValue(RESOURCE_TYPE_FIELD))
|
.getIndexableObjectService((Integer) doc.getFirstValue(RESOURCE_TYPE_FIELD))
|
||||||
.find(context, UUID.fromString((String) doc.getFirstValue(RESOURCE_ID_FIELD)));
|
.find(context, UUID.fromString((String) doc.getFirstValue(RESOURCE_ID_FIELD)));
|
||||||
|
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
@@ -2282,7 +2282,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
// Any acception that we get ignore it.
|
// Any acception that we get ignore it.
|
||||||
// We do NOT want any crashed to shown by the user
|
// We do NOT want any crashed to shown by the user
|
||||||
log.error(LogManager.getHeader(context, "Error while quering solr", "Query: " + query), e);
|
log.error(LogManager.getHeader(context, "Error while quering solr", "Query: " + query), e);
|
||||||
return new ArrayList<BrowsableObject>(0);
|
return new ArrayList<IndexableObject>(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2375,7 +2375,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
SolrDocumentList relatedDocs = (SolrDocumentList) mltResults.get(item.getType() + "-" + item.getID());
|
SolrDocumentList relatedDocs = (SolrDocumentList) mltResults.get(item.getType() + "-" + item.getID());
|
||||||
for (Object relatedDoc : relatedDocs) {
|
for (Object relatedDoc : relatedDocs) {
|
||||||
SolrDocument relatedDocument = (SolrDocument) relatedDoc;
|
SolrDocument relatedDocument = (SolrDocument) relatedDoc;
|
||||||
BrowsableObject relatedItem = findDSpaceObject(context, relatedDocument);
|
IndexableObject relatedItem = findIndexableObject(context, relatedDocument);
|
||||||
if (relatedItem.getType() == Constants.ITEM) {
|
if (relatedItem.getType() == Constants.ITEM) {
|
||||||
results.add((Item) relatedItem);
|
results.add((Item) relatedItem);
|
||||||
}
|
}
|
||||||
@@ -2536,7 +2536,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void indexContent(Context context, BrowsableObject dso, boolean force,
|
public void indexContent(Context context, IndexableObject dso, boolean force,
|
||||||
boolean commit) throws SearchServiceException, SQLException {
|
boolean commit) throws SearchServiceException, SQLException {
|
||||||
indexContent(context, dso, force);
|
indexContent(context, dso, force);
|
||||||
if (commit) {
|
if (commit) {
|
||||||
@@ -2565,7 +2565,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FacetYearRange getFacetYearRange(Context context, BrowsableObject scope,
|
public FacetYearRange getFacetYearRange(Context context, IndexableObject scope,
|
||||||
DiscoverySearchFilterFacet facet, List<String> filterQueries,
|
DiscoverySearchFilterFacet facet, List<String> filterQueries,
|
||||||
DiscoverQuery parentQuery) throws SearchServiceException {
|
DiscoverQuery parentQuery) throws SearchServiceException {
|
||||||
FacetYearRange result = new FacetYearRange(facet);
|
FacetYearRange result = new FacetYearRange(facet);
|
||||||
@@ -2587,9 +2587,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
maxQuery.setSortField(sortField, sortOrder);
|
maxQuery.setSortField(sortField, sortOrder);
|
||||||
maxQuery.addSearchField(valueField);
|
maxQuery.addSearchField(valueField);
|
||||||
DiscoverResult maxResult = this.search(context,maxQuery);
|
DiscoverResult maxResult = this.search(context,maxQuery);
|
||||||
if (0 < maxResult.getDspaceObjects().size()) {
|
if (0 < maxResult.getIndexableObjects().size()) {
|
||||||
List<DiscoverResult.SearchDocument> searchDocuments = maxResult
|
List<DiscoverResult.SearchDocument> searchDocuments = maxResult
|
||||||
.getSearchDocument(maxResult.getDspaceObjects().get(0));
|
.getSearchDocument(maxResult.getIndexableObjects().get(0));
|
||||||
if (0 < searchDocuments.size() && 0 < searchDocuments.get(0).getSearchFieldValues
|
if (0 < searchDocuments.size() && 0 < searchDocuments.get(0).getSearchFieldValues
|
||||||
(valueField).size()) {
|
(valueField).size()) {
|
||||||
return searchDocuments.get(0).getSearchFieldValues(valueField).get(0);
|
return searchDocuments.get(0).getSearchFieldValues(valueField).get(0);
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
package org.dspace.discovery;
|
package org.dspace.discovery;
|
||||||
|
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ import org.dspace.core.Context;
|
|||||||
public class SolrServiceIndexOutputPlugin implements SolrServiceIndexPlugin {
|
public class SolrServiceIndexOutputPlugin implements SolrServiceIndexPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void additionalIndex(Context context, BrowsableObject dso, SolrInputDocument document) {
|
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document) {
|
||||||
System.out.println("Currently indexing: " + dso.getUniqueIndexID());
|
System.out.println("Currently indexing: " + dso.getUniqueIndexID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
package org.dspace.discovery;
|
package org.dspace.discovery;
|
||||||
|
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,5 +20,5 @@ import org.dspace.core.Context;
|
|||||||
*/
|
*/
|
||||||
public interface SolrServiceIndexPlugin {
|
public interface SolrServiceIndexPlugin {
|
||||||
|
|
||||||
public void additionalIndex(Context context, BrowsableObject dso, SolrInputDocument document);
|
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document);
|
||||||
}
|
}
|
||||||
|
@@ -15,9 +15,9 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
import org.dspace.browse.BrowsableObject;
|
|
||||||
import org.dspace.browse.BrowseException;
|
import org.dspace.browse.BrowseException;
|
||||||
import org.dspace.browse.BrowseIndex;
|
import org.dspace.browse.BrowseIndex;
|
||||||
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.content.MetadataValue;
|
import org.dspace.content.MetadataValue;
|
||||||
import org.dspace.content.authority.service.ChoiceAuthorityService;
|
import org.dspace.content.authority.service.ChoiceAuthorityService;
|
||||||
@@ -57,7 +57,7 @@ public class SolrServiceMetadataBrowseIndexingPlugin implements SolrServiceIndex
|
|||||||
protected ChoiceAuthorityService choiceAuthorityService;
|
protected ChoiceAuthorityService choiceAuthorityService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void additionalIndex(Context context, BrowsableObject dso, SolrInputDocument document) {
|
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document) {
|
||||||
// Only works for Items
|
// Only works for Items
|
||||||
if (!(dso instanceof Item)) {
|
if (!(dso instanceof Item)) {
|
||||||
return;
|
return;
|
||||||
|
@@ -18,7 +18,7 @@ import org.apache.solr.common.SolrInputDocument;
|
|||||||
import org.dspace.authorize.ResourcePolicy;
|
import org.dspace.authorize.ResourcePolicy;
|
||||||
import org.dspace.authorize.service.AuthorizeService;
|
import org.dspace.authorize.service.AuthorizeService;
|
||||||
import org.dspace.authorize.service.ResourcePolicyService;
|
import org.dspace.authorize.service.ResourcePolicyService;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.content.service.CollectionService;
|
import org.dspace.content.service.CollectionService;
|
||||||
import org.dspace.content.service.CommunityService;
|
import org.dspace.content.service.CommunityService;
|
||||||
@@ -56,7 +56,7 @@ public class SolrServiceResourceRestrictionPlugin implements SolrServiceIndexPlu
|
|||||||
protected ResourcePolicyService resourcePolicyService;
|
protected ResourcePolicyService resourcePolicyService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void additionalIndex(Context context, BrowsableObject bdso, SolrInputDocument document) {
|
public void additionalIndex(Context context, IndexableObject bdso, SolrInputDocument document) {
|
||||||
if (!(bdso instanceof DSpaceObject)) {
|
if (!(bdso instanceof DSpaceObject)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@ package org.dspace.discovery;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.content.MetadataValue;
|
import org.dspace.content.MetadataValue;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
@@ -30,7 +30,7 @@ public class SolrServiceSpellIndexingPlugin implements SolrServiceIndexPlugin {
|
|||||||
protected ItemService itemService;
|
protected ItemService itemService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void additionalIndex(Context context, BrowsableObject dso, SolrInputDocument document) {
|
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document) {
|
||||||
if (dso instanceof Item) {
|
if (dso instanceof Item) {
|
||||||
Item item = (Item) dso;
|
Item item = (Item) dso;
|
||||||
List<MetadataValue> dcValues = itemService.getMetadata(item, Item.ANY, Item.ANY, Item.ANY, Item.ANY);
|
List<MetadataValue> dcValues = itemService.getMetadata(item, Item.ANY, Item.ANY, Item.ANY, Item.ANY);
|
||||||
|
@@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public class DiscoveryConfigurationService {
|
|||||||
this.toIgnoreMetadataFields = toIgnoreMetadataFields;
|
this.toIgnoreMetadataFields = toIgnoreMetadataFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiscoveryConfiguration getDiscoveryConfiguration(BrowsableObject dso) {
|
public DiscoveryConfiguration getDiscoveryConfiguration(IndexableObject dso) {
|
||||||
String name;
|
String name;
|
||||||
if (dso == null) {
|
if (dso == null) {
|
||||||
name = "site";
|
name = "site";
|
||||||
@@ -76,7 +76,7 @@ public class DiscoveryConfigurationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DiscoveryConfiguration getDiscoveryConfigurationByNameOrDso(final String configurationName,
|
public DiscoveryConfiguration getDiscoveryConfigurationByNameOrDso(final String configurationName,
|
||||||
final BrowsableObject dso) {
|
final IndexableObject dso) {
|
||||||
if (StringUtils.isNotBlank(configurationName) && getMap().containsKey(configurationName)) {
|
if (StringUtils.isNotBlank(configurationName) && getMap().containsKey(configurationName)) {
|
||||||
return getMap().get(configurationName);
|
return getMap().get(configurationName);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -17,7 +17,7 @@ import java.util.List;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||||
import org.dspace.authorize.service.AuthorizeService;
|
import org.dspace.authorize.service.AuthorizeService;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.Community;
|
import org.dspace.content.Community;
|
||||||
import org.dspace.content.DCDate;
|
import org.dspace.content.DCDate;
|
||||||
@@ -140,7 +140,7 @@ public class Harvest {
|
|||||||
DiscoverResult discoverResult = SearchUtils.getSearchService().search(context, discoverQuery);
|
DiscoverResult discoverResult = SearchUtils.getSearchService().search(context, discoverQuery);
|
||||||
|
|
||||||
// Process results of query into HarvestedItemInfo objects
|
// Process results of query into HarvestedItemInfo objects
|
||||||
Iterator<BrowsableObject> dsoIterator = discoverResult.getDspaceObjects().iterator();
|
Iterator<IndexableObject> dsoIterator = discoverResult.getIndexableObjects().iterator();
|
||||||
while (dsoIterator.hasNext() && ((limit == 0) || (itemCounter < limit))) {
|
while (dsoIterator.hasNext() && ((limit == 0) || (itemCounter < limit))) {
|
||||||
// the query is limited to ITEM
|
// the query is limited to ITEM
|
||||||
DSpaceObject dso = (DSpaceObject) dsoIterator.next();
|
DSpaceObject dso = (DSpaceObject) dsoIterator.next();
|
||||||
|
@@ -22,7 +22,7 @@ import javax.persistence.SequenceGenerator;
|
|||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.core.ReloadableEntity;
|
import org.dspace.core.ReloadableEntity;
|
||||||
@@ -38,7 +38,7 @@ import org.dspace.eperson.EPerson;
|
|||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "cwf_claimtask")
|
@Table(name = "cwf_claimtask")
|
||||||
public class ClaimedTask implements ReloadableEntity<Integer>, BrowsableObject<Integer> {
|
public class ClaimedTask implements ReloadableEntity<Integer>, IndexableObject<Integer> {
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
public transient Map<String, Object> extraInfo = new HashMap<String, Object>();
|
public transient Map<String, Object> extraInfo = new HashMap<String, Object>();
|
||||||
|
@@ -23,7 +23,7 @@ import javax.persistence.SequenceGenerator;
|
|||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.core.ReloadableEntity;
|
import org.dspace.core.ReloadableEntity;
|
||||||
@@ -40,7 +40,7 @@ import org.dspace.eperson.Group;
|
|||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "cwf_pooltask")
|
@Table(name = "cwf_pooltask")
|
||||||
public class PoolTask implements ReloadableEntity<Integer>, BrowsableObject<Integer> {
|
public class PoolTask implements ReloadableEntity<Integer>, IndexableObject<Integer> {
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
public transient Map<String, Object> extraInfo = new HashMap<String, Object>();
|
public transient Map<String, Object> extraInfo = new HashMap<String, Object>();
|
||||||
|
@@ -22,7 +22,7 @@ import javax.persistence.SequenceGenerator;
|
|||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
@@ -42,7 +42,7 @@ import org.dspace.workflow.factory.WorkflowServiceFactory;
|
|||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "cwf_workflowitem")
|
@Table(name = "cwf_workflowitem")
|
||||||
public class XmlWorkflowItem implements WorkflowItem, ReloadableEntity<Integer>, BrowsableObject<Integer> {
|
public class XmlWorkflowItem implements WorkflowItem, ReloadableEntity<Integer>, IndexableObject<Integer> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "workflowitem_id")
|
@Column(name = "workflowitem_id")
|
||||||
|
@@ -11,7 +11,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.content.service.BrowsableObjectService;
|
import org.dspace.content.service.IndexableObjectService;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.eperson.EPerson;
|
import org.dspace.eperson.EPerson;
|
||||||
import org.dspace.service.DSpaceCRUDService;
|
import org.dspace.service.DSpaceCRUDService;
|
||||||
@@ -26,7 +26,7 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
|||||||
* @author kevinvandevelde at atmire.com
|
* @author kevinvandevelde at atmire.com
|
||||||
*/
|
*/
|
||||||
public interface ClaimedTaskService extends DSpaceCRUDService<ClaimedTask>,
|
public interface ClaimedTaskService extends DSpaceCRUDService<ClaimedTask>,
|
||||||
BrowsableObjectService<ClaimedTask, Integer> {
|
IndexableObjectService<ClaimedTask, Integer> {
|
||||||
|
|
||||||
public List<ClaimedTask> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
public List<ClaimedTask> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.content.service.BrowsableObjectService;
|
import org.dspace.content.service.IndexableObjectService;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.eperson.EPerson;
|
import org.dspace.eperson.EPerson;
|
||||||
import org.dspace.service.DSpaceCRUDService;
|
import org.dspace.service.DSpaceCRUDService;
|
||||||
@@ -26,7 +26,7 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
|||||||
*
|
*
|
||||||
* @author kevinvandevelde at atmire.com
|
* @author kevinvandevelde at atmire.com
|
||||||
*/
|
*/
|
||||||
public interface PoolTaskService extends DSpaceCRUDService<PoolTask>, BrowsableObjectService<PoolTask, Integer> {
|
public interface PoolTaskService extends DSpaceCRUDService<PoolTask>, IndexableObjectService<PoolTask, Integer> {
|
||||||
public List<PoolTask> findByEperson(Context context, EPerson ePerson)
|
public List<PoolTask> findByEperson(Context context, EPerson ePerson)
|
||||||
throws SQLException, AuthorizeException, IOException;
|
throws SQLException, AuthorizeException, IOException;
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@ import org.dspace.app.util.factory.UtilServiceFactory;
|
|||||||
import org.dspace.app.util.service.OpenSearchService;
|
import org.dspace.app.util.service.OpenSearchService;
|
||||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||||
import org.dspace.authorize.service.AuthorizeService;
|
import org.dspace.authorize.service.AuthorizeService;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.CollectionService;
|
import org.dspace.content.service.CollectionService;
|
||||||
@@ -141,7 +141,7 @@ public class OpenSearchController {
|
|||||||
|
|
||||||
// format and return results
|
// format and return results
|
||||||
Map<String, String> labelMap = getLabels(request);
|
Map<String, String> labelMap = getLabels(request);
|
||||||
List<BrowsableObject> dsoResults = qResults.getDspaceObjects();
|
List<IndexableObject> dsoResults = qResults.getIndexableObjects();
|
||||||
Document resultsDoc = openSearchService.getResultsDoc(context, format, query,
|
Document resultsDoc = openSearchService.getResultsDoc(context, format, query,
|
||||||
(int) qResults.getTotalSearchResults(), qResults.getStart(),
|
(int) qResults.getTotalSearchResults(), qResults.getStart(),
|
||||||
qResults.getMaxResults(), container, dsoResults, labelMap);
|
qResults.getMaxResults(), container, dsoResults, labelMap);
|
||||||
|
@@ -9,7 +9,7 @@ package org.dspace.app.rest.converter;
|
|||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.app.rest.model.ClaimedTaskRest;
|
import org.dspace.app.rest.model.ClaimedTaskRest;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class ClaimedTaskConverter
|
public class ClaimedTaskConverter
|
||||||
extends BrowsableDSpaceObjectConverter<ClaimedTask, org.dspace.app.rest.model.ClaimedTaskRest> {
|
extends IndexableDSpaceObjectConverter<ClaimedTask, org.dspace.app.rest.model.ClaimedTaskRest> {
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(ClaimedTaskConverter.class);
|
private static final Logger log = Logger.getLogger(ClaimedTaskConverter.class);
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ public class ClaimedTaskConverter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsModel(BrowsableObject object) {
|
public boolean supportsModel(IndexableObject object) {
|
||||||
return object instanceof ClaimedTask;
|
return object instanceof ClaimedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.dspace.app.rest.converter;
|
package org.dspace.app.rest.converter;
|
||||||
|
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.DSpaceObject;
|
import org.dspace.content.DSpaceObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
*/
|
*/
|
||||||
public abstract class DSpaceObjectConverter<M extends DSpaceObject, R extends org.dspace.app.rest.model
|
public abstract class DSpaceObjectConverter<M extends DSpaceObject, R extends org.dspace.app.rest.model
|
||||||
.DSpaceObjectRest>
|
.DSpaceObjectRest>
|
||||||
extends BrowsableDSpaceObjectConverter<M, R> {
|
extends IndexableDSpaceObjectConverter<M, R> {
|
||||||
|
|
||||||
@Autowired(required = true)
|
@Autowired(required = true)
|
||||||
private MetadataConverter metadataConverter;
|
private MetadataConverter metadataConverter;
|
||||||
@@ -43,7 +43,7 @@ public abstract class DSpaceObjectConverter<M extends DSpaceObject, R extends or
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean supportsModel(BrowsableObject object) {
|
public boolean supportsModel(IndexableObject object) {
|
||||||
return object != null && object.getClass().equals(getModelClass());
|
return object != null && object.getClass().equals(getModelClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ import org.dspace.app.rest.model.RestAddressableModel;
|
|||||||
import org.dspace.app.rest.model.SearchResultEntryRest;
|
import org.dspace.app.rest.model.SearchResultEntryRest;
|
||||||
import org.dspace.app.rest.model.SearchResultsRest;
|
import org.dspace.app.rest.model.SearchResultsRest;
|
||||||
import org.dspace.app.rest.parameter.SearchFilter;
|
import org.dspace.app.rest.parameter.SearchFilter;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.discovery.DiscoverResult;
|
import org.dspace.discovery.DiscoverResult;
|
||||||
import org.dspace.discovery.configuration.DiscoveryConfiguration;
|
import org.dspace.discovery.configuration.DiscoveryConfiguration;
|
||||||
@@ -36,7 +36,7 @@ public class DiscoverResultConverter {
|
|||||||
private static final Logger log = Logger.getLogger(DiscoverResultConverter.class);
|
private static final Logger log = Logger.getLogger(DiscoverResultConverter.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private List<BrowsableDSpaceObjectConverter> converters;
|
private List<IndexableDSpaceObjectConverter> converters;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DiscoverFacetsConverter facetConverter;
|
private DiscoverFacetsConverter facetConverter;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -66,14 +66,14 @@ public class DiscoverResultConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addSearchResults(final DiscoverResult searchResult, final SearchResultsRest resultsRest) {
|
private void addSearchResults(final DiscoverResult searchResult, final SearchResultsRest resultsRest) {
|
||||||
for (BrowsableObject dspaceObject : CollectionUtils.emptyIfNull(searchResult.getDspaceObjects())) {
|
for (IndexableObject dspaceObject : CollectionUtils.emptyIfNull(searchResult.getIndexableObjects())) {
|
||||||
SearchResultEntryRest resultEntry = new SearchResultEntryRest();
|
SearchResultEntryRest resultEntry = new SearchResultEntryRest();
|
||||||
|
|
||||||
//Convert the DSpace Object to its REST model
|
//Convert the DSpace Object to its REST model
|
||||||
resultEntry.setRObject(convertDSpaceObject(dspaceObject));
|
resultEntry.setRObject(convertDSpaceObject(dspaceObject));
|
||||||
|
|
||||||
//Add hit highlighting for this DSO if present
|
//Add hit highlighting for this DSO if present
|
||||||
DiscoverResult.DSpaceObjectHighlightResult highlightedResults = searchResult
|
DiscoverResult.IndexableObjectHighlightResult highlightedResults = searchResult
|
||||||
.getHighlightedResults(dspaceObject);
|
.getHighlightedResults(dspaceObject);
|
||||||
if (highlightedResults != null && MapUtils.isNotEmpty(highlightedResults.getHighlightResults())) {
|
if (highlightedResults != null && MapUtils.isNotEmpty(highlightedResults.getHighlightResults())) {
|
||||||
for (Map.Entry<String, List<String>> metadataHighlight : highlightedResults.getHighlightResults()
|
for (Map.Entry<String, List<String>> metadataHighlight : highlightedResults.getHighlightResults()
|
||||||
@@ -86,8 +86,8 @@ public class DiscoverResultConverter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestAddressableModel convertDSpaceObject(final BrowsableObject dspaceObject) {
|
private RestAddressableModel convertDSpaceObject(final IndexableObject dspaceObject) {
|
||||||
for (BrowsableDSpaceObjectConverter<BrowsableObject, RestAddressableModel> converter : converters) {
|
for (IndexableDSpaceObjectConverter<IndexableObject, RestAddressableModel> converter : converters) {
|
||||||
if (converter.supportsModel(dspaceObject)) {
|
if (converter.supportsModel(dspaceObject)) {
|
||||||
return converter.convert(dspaceObject);
|
return converter.convert(dspaceObject);
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.dspace.app.rest.converter;
|
package org.dspace.app.rest.converter;
|
||||||
|
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the base converter from/to objects in the DSpace API data model and
|
* This is the base converter from/to objects in the DSpace API data model and
|
||||||
@@ -17,15 +17,15 @@ import org.dspace.browse.BrowsableObject;
|
|||||||
* @param <R> the Class in the DSpace REST data model
|
* @param <R> the Class in the DSpace REST data model
|
||||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||||
*/
|
*/
|
||||||
public abstract class BrowsableDSpaceObjectConverter<M extends BrowsableObject,
|
public abstract class IndexableDSpaceObjectConverter<M extends IndexableObject,
|
||||||
R extends org.dspace.app.rest.model.RestAddressableModel> extends DSpaceConverter<M, R> {
|
R extends org.dspace.app.rest.model.RestAddressableModel> extends DSpaceConverter<M, R> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param bdso
|
* @param idxo
|
||||||
* the BrowsableObject to check
|
* the IndexableObject to check
|
||||||
* @return true if the actual converter implementation is able to manage the supplied BrowsableObject
|
* @return true if the actual converter implementation is able to manage the supplied IndexableObject
|
||||||
*/
|
*/
|
||||||
public abstract boolean supportsModel(BrowsableObject bdso);
|
public abstract boolean supportsModel(IndexableObject idxo);
|
||||||
|
|
||||||
}
|
}
|
@@ -9,7 +9,7 @@ package org.dspace.app.rest.converter;
|
|||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.app.rest.model.PoolTaskRest;
|
import org.dspace.app.rest.model.PoolTaskRest;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class PoolTaskConverter
|
public class PoolTaskConverter
|
||||||
extends BrowsableDSpaceObjectConverter<PoolTask, org.dspace.app.rest.model.PoolTaskRest> {
|
extends IndexableDSpaceObjectConverter<PoolTask, org.dspace.app.rest.model.PoolTaskRest> {
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(PoolTaskConverter.class);
|
private static final Logger log = Logger.getLogger(PoolTaskConverter.class);
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ public class PoolTaskConverter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsModel(BrowsableObject object) {
|
public boolean supportsModel(IndexableObject object) {
|
||||||
return object instanceof PoolTask;
|
return object instanceof PoolTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@ import org.dspace.app.rest.submit.SubmissionService;
|
|||||||
import org.dspace.app.util.SubmissionConfigReader;
|
import org.dspace.app.util.SubmissionConfigReader;
|
||||||
import org.dspace.app.util.SubmissionConfigReaderException;
|
import org.dspace.app.util.SubmissionConfigReaderException;
|
||||||
import org.dspace.app.util.SubmissionStepConfig;
|
import org.dspace.app.util.SubmissionStepConfig;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.eperson.EPerson;
|
import org.dspace.eperson.EPerson;
|
||||||
@@ -38,7 +38,7 @@ import org.springframework.stereotype.Component;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class WorkflowItemConverter
|
public class WorkflowItemConverter
|
||||||
extends BrowsableDSpaceObjectConverter<XmlWorkflowItem, org.dspace.app.rest.model.WorkflowItemRest> {
|
extends IndexableDSpaceObjectConverter<XmlWorkflowItem, org.dspace.app.rest.model.WorkflowItemRest> {
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(WorkflowItemConverter.class);
|
private static final Logger log = Logger.getLogger(WorkflowItemConverter.class);
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ public class WorkflowItemConverter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsModel(BrowsableObject object) {
|
public boolean supportsModel(IndexableObject object) {
|
||||||
return object instanceof XmlWorkflowItem;
|
return object instanceof XmlWorkflowItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import org.dspace.app.rest.submit.SubmissionService;
|
|||||||
import org.dspace.app.util.SubmissionConfigReader;
|
import org.dspace.app.util.SubmissionConfigReader;
|
||||||
import org.dspace.app.util.SubmissionConfigReaderException;
|
import org.dspace.app.util.SubmissionConfigReaderException;
|
||||||
import org.dspace.app.util.SubmissionStepConfig;
|
import org.dspace.app.util.SubmissionStepConfig;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.content.WorkspaceItem;
|
import org.dspace.content.WorkspaceItem;
|
||||||
@@ -38,7 +38,7 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component
|
@Component
|
||||||
public class WorkspaceItemConverter
|
public class WorkspaceItemConverter
|
||||||
extends
|
extends
|
||||||
BrowsableDSpaceObjectConverter<org.dspace.content.WorkspaceItem, org.dspace.app.rest.model.WorkspaceItemRest> {
|
IndexableDSpaceObjectConverter<org.dspace.content.WorkspaceItem, org.dspace.app.rest.model.WorkspaceItemRest> {
|
||||||
|
|
||||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(WorkspaceItemConverter.class);
|
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(WorkspaceItemConverter.class);
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ public class WorkspaceItemConverter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsModel(BrowsableObject object) {
|
public boolean supportsModel(IndexableObject object) {
|
||||||
return object instanceof WorkspaceItem;
|
return object instanceof WorkspaceItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -20,12 +21,12 @@ import org.dspace.app.rest.model.BrowseEntryRest;
|
|||||||
import org.dspace.app.rest.model.BrowseIndexRest;
|
import org.dspace.app.rest.model.BrowseIndexRest;
|
||||||
import org.dspace.app.rest.model.hateoas.BrowseEntryResource;
|
import org.dspace.app.rest.model.hateoas.BrowseEntryResource;
|
||||||
import org.dspace.app.rest.utils.ScopeResolver;
|
import org.dspace.app.rest.utils.ScopeResolver;
|
||||||
import org.dspace.browse.BrowsableObject;
|
|
||||||
import org.dspace.browse.BrowseEngine;
|
import org.dspace.browse.BrowseEngine;
|
||||||
import org.dspace.browse.BrowseException;
|
import org.dspace.browse.BrowseException;
|
||||||
import org.dspace.browse.BrowseIndex;
|
import org.dspace.browse.BrowseIndex;
|
||||||
import org.dspace.browse.BrowseInfo;
|
import org.dspace.browse.BrowseInfo;
|
||||||
import org.dspace.browse.BrowserScope;
|
import org.dspace.browse.BrowserScope;
|
||||||
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -73,7 +74,7 @@ public class BrowseEntryLinkRepository extends AbstractDSpaceRestRepository
|
|||||||
BrowseEngine be = new BrowseEngine(context);
|
BrowseEngine be = new BrowseEngine(context);
|
||||||
BrowserScope bs = new BrowserScope(context);
|
BrowserScope bs = new BrowserScope(context);
|
||||||
|
|
||||||
BrowsableObject scopeObj = scopeResolver.resolveScope(context, scope);
|
IndexableObject scopeObj = scopeResolver.resolveScope(context, scope);
|
||||||
|
|
||||||
// process the input, performing some inline validation
|
// process the input, performing some inline validation
|
||||||
final BrowseIndex bi;
|
final BrowseIndex bi;
|
||||||
|
@@ -11,6 +11,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -19,12 +20,12 @@ import org.dspace.app.rest.model.BrowseIndexRest;
|
|||||||
import org.dspace.app.rest.model.ItemRest;
|
import org.dspace.app.rest.model.ItemRest;
|
||||||
import org.dspace.app.rest.model.hateoas.ItemResource;
|
import org.dspace.app.rest.model.hateoas.ItemResource;
|
||||||
import org.dspace.app.rest.utils.ScopeResolver;
|
import org.dspace.app.rest.utils.ScopeResolver;
|
||||||
import org.dspace.browse.BrowsableObject;
|
|
||||||
import org.dspace.browse.BrowseEngine;
|
import org.dspace.browse.BrowseEngine;
|
||||||
import org.dspace.browse.BrowseException;
|
import org.dspace.browse.BrowseException;
|
||||||
import org.dspace.browse.BrowseIndex;
|
import org.dspace.browse.BrowseIndex;
|
||||||
import org.dspace.browse.BrowseInfo;
|
import org.dspace.browse.BrowseInfo;
|
||||||
import org.dspace.browse.BrowserScope;
|
import org.dspace.browse.BrowserScope;
|
||||||
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.sort.SortException;
|
import org.dspace.sort.SortException;
|
||||||
@@ -75,7 +76,7 @@ public class BrowseItemLinkRepository extends AbstractDSpaceRestRepository
|
|||||||
BrowseEngine be = new BrowseEngine(context);
|
BrowseEngine be = new BrowseEngine(context);
|
||||||
BrowserScope bs = new BrowserScope(context);
|
BrowserScope bs = new BrowserScope(context);
|
||||||
|
|
||||||
BrowsableObject scopeObj = scopeResolver.resolveScope(context, scope);
|
IndexableObject scopeObj = scopeResolver.resolveScope(context, scope);
|
||||||
|
|
||||||
// process the input, performing some inline validation
|
// process the input, performing some inline validation
|
||||||
BrowseIndex bi = null;
|
BrowseIndex bi = null;
|
||||||
@@ -152,7 +153,7 @@ public class BrowseItemLinkRepository extends AbstractDSpaceRestRepository
|
|||||||
Pageable pageResultInfo =
|
Pageable pageResultInfo =
|
||||||
new PageRequest((binfo.getStart() - 1) / binfo.getResultsPerPage(), binfo.getResultsPerPage());
|
new PageRequest((binfo.getStart() - 1) / binfo.getResultsPerPage(), binfo.getResultsPerPage());
|
||||||
List<Item> tmpResult = new ArrayList<Item>();
|
List<Item> tmpResult = new ArrayList<Item>();
|
||||||
for (BrowsableObject bb : binfo.getBrowseItemResults()) {
|
for (IndexableObject bb : binfo.getBrowseItemResults()) {
|
||||||
tmpResult.add((Item) bb);
|
tmpResult.add((Item) bb);
|
||||||
}
|
}
|
||||||
Page<ItemRest> page = new PageImpl<Item>(tmpResult, pageResultInfo, binfo.getTotal()).map(converter);
|
Page<ItemRest> page = new PageImpl<Item>(tmpResult, pageResultInfo, binfo.getTotal()).map(converter);
|
||||||
|
@@ -26,7 +26,7 @@ import org.dspace.app.rest.model.SearchSupportRest;
|
|||||||
import org.dspace.app.rest.parameter.SearchFilter;
|
import org.dspace.app.rest.parameter.SearchFilter;
|
||||||
import org.dspace.app.rest.utils.DiscoverQueryBuilder;
|
import org.dspace.app.rest.utils.DiscoverQueryBuilder;
|
||||||
import org.dspace.app.rest.utils.ScopeResolver;
|
import org.dspace.app.rest.utils.ScopeResolver;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.discovery.DiscoverQuery;
|
import org.dspace.discovery.DiscoverQuery;
|
||||||
import org.dspace.discovery.DiscoverResult;
|
import org.dspace.discovery.DiscoverResult;
|
||||||
@@ -82,7 +82,7 @@ public class DiscoveryRestRepository extends AbstractDSpaceRestRepository {
|
|||||||
public SearchConfigurationRest getSearchConfiguration(final String dsoScope, final String configuration) {
|
public SearchConfigurationRest getSearchConfiguration(final String dsoScope, final String configuration) {
|
||||||
Context context = obtainContext();
|
Context context = obtainContext();
|
||||||
|
|
||||||
BrowsableObject scopeObject = scopeResolver.resolveScope(context, dsoScope);
|
IndexableObject scopeObject = scopeResolver.resolveScope(context, dsoScope);
|
||||||
DiscoveryConfiguration discoveryConfiguration = searchConfigurationService
|
DiscoveryConfiguration discoveryConfiguration = searchConfigurationService
|
||||||
.getDiscoveryConfigurationByNameOrDso(configuration, scopeObject);
|
.getDiscoveryConfigurationByNameOrDso(configuration, scopeObject);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ public class DiscoveryRestRepository extends AbstractDSpaceRestRepository {
|
|||||||
final List<SearchFilter> searchFilters, final Pageable page)
|
final List<SearchFilter> searchFilters, final Pageable page)
|
||||||
throws InvalidRequestException {
|
throws InvalidRequestException {
|
||||||
Context context = obtainContext();
|
Context context = obtainContext();
|
||||||
BrowsableObject scopeObject = scopeResolver.resolveScope(context, dsoScope);
|
IndexableObject scopeObject = scopeResolver.resolveScope(context, dsoScope);
|
||||||
DiscoveryConfiguration discoveryConfiguration = searchConfigurationService
|
DiscoveryConfiguration discoveryConfiguration = searchConfigurationService
|
||||||
.getDiscoveryConfigurationByNameOrDso(configuration, scopeObject);
|
.getDiscoveryConfigurationByNameOrDso(configuration, scopeObject);
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ public class DiscoveryRestRepository extends AbstractDSpaceRestRepository {
|
|||||||
public FacetConfigurationRest getFacetsConfiguration(final String dsoScope, final String configuration) {
|
public FacetConfigurationRest getFacetsConfiguration(final String dsoScope, final String configuration) {
|
||||||
Context context = obtainContext();
|
Context context = obtainContext();
|
||||||
|
|
||||||
BrowsableObject scopeObject = scopeResolver.resolveScope(context, dsoScope);
|
IndexableObject scopeObject = scopeResolver.resolveScope(context, dsoScope);
|
||||||
DiscoveryConfiguration discoveryConfiguration = searchConfigurationService
|
DiscoveryConfiguration discoveryConfiguration = searchConfigurationService
|
||||||
.getDiscoveryConfigurationByNameOrDso(configuration, scopeObject);
|
.getDiscoveryConfigurationByNameOrDso(configuration, scopeObject);
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ public class DiscoveryRestRepository extends AbstractDSpaceRestRepository {
|
|||||||
|
|
||||||
Context context = obtainContext();
|
Context context = obtainContext();
|
||||||
|
|
||||||
BrowsableObject scopeObject = scopeResolver.resolveScope(context, dsoScope);
|
IndexableObject scopeObject = scopeResolver.resolveScope(context, dsoScope);
|
||||||
DiscoveryConfiguration discoveryConfiguration = searchConfigurationService
|
DiscoveryConfiguration discoveryConfiguration = searchConfigurationService
|
||||||
.getDiscoveryConfigurationByNameOrDso(configuration, scopeObject);
|
.getDiscoveryConfigurationByNameOrDso(configuration, scopeObject);
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ public class DiscoveryRestRepository extends AbstractDSpaceRestRepository {
|
|||||||
|
|
||||||
Context context = obtainContext();
|
Context context = obtainContext();
|
||||||
Pageable page = new PageRequest(1, 1);
|
Pageable page = new PageRequest(1, 1);
|
||||||
BrowsableObject scopeObject = scopeResolver.resolveScope(context, dsoScope);
|
IndexableObject scopeObject = scopeResolver.resolveScope(context, dsoScope);
|
||||||
DiscoveryConfiguration discoveryConfiguration = searchConfigurationService
|
DiscoveryConfiguration discoveryConfiguration = searchConfigurationService
|
||||||
.getDiscoveryConfigurationByNameOrDso(configuration, scopeObject);
|
.getDiscoveryConfigurationByNameOrDso(configuration, scopeObject);
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ import org.dspace.app.rest.exception.InvalidSearchFacetException;
|
|||||||
import org.dspace.app.rest.exception.InvalidSearchFilterException;
|
import org.dspace.app.rest.exception.InvalidSearchFilterException;
|
||||||
import org.dspace.app.rest.exception.InvalidSortingException;
|
import org.dspace.app.rest.exception.InvalidSortingException;
|
||||||
import org.dspace.app.rest.parameter.SearchFilter;
|
import org.dspace.app.rest.parameter.SearchFilter;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.core.LogManager;
|
import org.dspace.core.LogManager;
|
||||||
@@ -67,7 +67,7 @@ public class DiscoverQueryBuilder implements InitializingBean {
|
|||||||
pageSizeLimit = configurationService.getIntProperty("rest.search.max.results", 100);
|
pageSizeLimit = configurationService.getIntProperty("rest.search.max.results", 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiscoverQuery buildQuery(Context context, BrowsableObject scope,
|
public DiscoverQuery buildQuery(Context context, IndexableObject scope,
|
||||||
DiscoveryConfiguration discoveryConfiguration,
|
DiscoveryConfiguration discoveryConfiguration,
|
||||||
String query, List<SearchFilter> searchFilters,
|
String query, List<SearchFilter> searchFilters,
|
||||||
String dsoType, Pageable page)
|
String dsoType, Pageable page)
|
||||||
@@ -100,7 +100,7 @@ public class DiscoverQueryBuilder implements InitializingBean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiscoverQuery buildFacetQuery(Context context, BrowsableObject scope,
|
public DiscoverQuery buildFacetQuery(Context context, IndexableObject scope,
|
||||||
DiscoveryConfiguration discoveryConfiguration,
|
DiscoveryConfiguration discoveryConfiguration,
|
||||||
String prefix, String query, List<SearchFilter> searchFilters,
|
String prefix, String query, List<SearchFilter> searchFilters,
|
||||||
String dsoType, Pageable page, String facetName)
|
String dsoType, Pageable page, String facetName)
|
||||||
@@ -127,7 +127,7 @@ public class DiscoverQueryBuilder implements InitializingBean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DiscoverQuery addFacetingForFacets(Context context, BrowsableObject scope, String prefix,
|
private DiscoverQuery addFacetingForFacets(Context context, IndexableObject scope, String prefix,
|
||||||
DiscoverQuery queryArgs, DiscoveryConfiguration discoveryConfiguration, String facetName, Pageable page)
|
DiscoverQuery queryArgs, DiscoveryConfiguration discoveryConfiguration, String facetName, Pageable page)
|
||||||
throws InvalidSearchFacetException {
|
throws InvalidSearchFacetException {
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ public class DiscoverQueryBuilder implements InitializingBean {
|
|||||||
return queryArgs;
|
return queryArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillFacetIntoQueryArgs(Context context, BrowsableObject scope, String prefix,
|
private void fillFacetIntoQueryArgs(Context context, IndexableObject scope, String prefix,
|
||||||
DiscoverQuery queryArgs, DiscoverySearchFilterFacet facet, final int pageSize) {
|
DiscoverQuery queryArgs, DiscoverySearchFilterFacet facet, final int pageSize) {
|
||||||
if (facet.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE)) {
|
if (facet.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE)) {
|
||||||
try {
|
try {
|
||||||
@@ -310,7 +310,7 @@ public class DiscoverQueryBuilder implements InitializingBean {
|
|||||||
return filterQueries.toArray(new String[filterQueries.size()]);
|
return filterQueries.toArray(new String[filterQueries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DiscoverQuery addFaceting(Context context, BrowsableObject scope, DiscoverQuery queryArgs,
|
private DiscoverQuery addFaceting(Context context, IndexableObject scope, DiscoverQuery queryArgs,
|
||||||
DiscoveryConfiguration discoveryConfiguration) {
|
DiscoveryConfiguration discoveryConfiguration) {
|
||||||
|
|
||||||
List<DiscoverySearchFilterFacet> facets = discoveryConfiguration.getSidebarFacets();
|
List<DiscoverySearchFilterFacet> facets = discoveryConfiguration.getSidebarFacets();
|
||||||
|
@@ -28,7 +28,7 @@ import org.dspace.app.rest.exception.InvalidSearchFacetException;
|
|||||||
import org.dspace.app.rest.exception.InvalidSearchFilterException;
|
import org.dspace.app.rest.exception.InvalidSearchFilterException;
|
||||||
import org.dspace.app.rest.exception.InvalidSortingException;
|
import org.dspace.app.rest.exception.InvalidSortingException;
|
||||||
import org.dspace.app.rest.parameter.SearchFilter;
|
import org.dspace.app.rest.parameter.SearchFilter;
|
||||||
import org.dspace.browse.BrowsableObject;
|
import org.dspace.browse.IndexableObject;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.discovery.DiscoverFacetField;
|
import org.dspace.discovery.DiscoverFacetField;
|
||||||
@@ -75,7 +75,7 @@ public class DiscoverQueryBuilderTest {
|
|||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private BrowsableObject scope;
|
private IndexableObject scope;
|
||||||
|
|
||||||
private DiscoveryConfiguration discoveryConfiguration;
|
private DiscoveryConfiguration discoveryConfiguration;
|
||||||
private String query;
|
private String query;
|
||||||
@@ -92,7 +92,7 @@ public class DiscoverQueryBuilderTest {
|
|||||||
.then(invocation -> invocation.getArguments()[0] + "_sort");
|
.then(invocation -> invocation.getArguments()[0] + "_sort");
|
||||||
|
|
||||||
when(searchService
|
when(searchService
|
||||||
.getFacetYearRange(eq(context), any(BrowsableObject.class), any(DiscoverySearchFilterFacet.class),
|
.getFacetYearRange(eq(context), any(IndexableObject.class), any(DiscoverySearchFilterFacet.class),
|
||||||
any(), any(DiscoverQuery.class)))
|
any(), any(DiscoverQuery.class)))
|
||||||
.then(invocation -> new FacetYearRange((DiscoverySearchFilterFacet) invocation.getArguments()[2]));
|
.then(invocation -> new FacetYearRange((DiscoverySearchFilterFacet) invocation.getArguments()[2]));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user