El 11/11/16 a las 10:37, Róbert Bodnár escribió:
Hi all!
May I ask if it is possible to exclude communities and collections from
being harvested by the OAI?
More exactly I want to find a way to exclude some collection when
transmitting data through OAI to other parties.
Any ideas are welcome!
Thank you very much!
B. Róbert
--
You received this message because you are subscribed to the Google
Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.
Hi Róbert!
You are lucky, I implemented it some time ago. Just for one collection,
though. It's implemented as an XOAI filter (attached).
- Put RecercatFilter.java in
dspace-oai/src/main/java/org/dspace/xoai/filter/RecercatFilter.java
- Define the filter in the Filters section of xoai.xml:
<Filter id="recercatFilter">
<Class>org.dspace.xoai.filter.RecercatFilter</Class>
<Parameter key="excludeSet">
<Value>col_10459.1_371</Value>
</Parameter>
</Filter>
- Add the filter to your context:
<Context baseurl="request">
[...]
<Filter refid="recercatFilter" />
</Context>
Cheers,
Àlex
--
You received this message because you are subscribed to the Google Groups "DSpace
Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.
package org.dspace.xoai.filter;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.dspace.core.Context;
import org.dspace.xoai.data.DSpaceItem;
/**
* Excludes records from the set specified in the <code>excludeSet</code>
* parameter.
*
* IMPORTANT: it only works with the Solr backend.
*
* @author Ãlex Magaz Graça
*/
public class RecercatFilter extends DSpaceFilter {
private static Logger log = LogManager.getLogger(RecercatFilter.class);
private String _excludeSet;
private String getExcludeSet()
{
// TODO: get the exclude collection (just one for now)
if (this._excludeSet == null)
this._excludeSet = super.getParameter("excludeSet");
return _excludeSet;
}
@Override
public DatabaseFilterResult getWhere(Context context)
{
throw new UnsupportedOperationException("This method have not been "
+ "implemented, we only support the Solr backend.");
}
@Override
public boolean isShown(DSpaceItem item)
{
if ( item.getSets().contains(getExcludeSet()) )
return false;
return true;
}
@Override
public SolrFilterResult getQuery()
{
/* NOTE: look at this same method in DSpaceMetadataExistsFilter
if we ever need to filter out more than one set. */
StringBuilder cond = new StringBuilder("*:* NOT item.collections:");
cond.append( getExcludeSet() );
return new SolrFilterResult( cond.toString() );
}
}