Merge pull request #139 from atmire/DS-1345

Ds 1345,DS-1346 Bugfix for the fact that all versions where searchable/browsable
This commit is contained in:
Robin Taylor
2012-11-26 01:37:31 -08:00
4 changed files with 9 additions and 9 deletions

View File

@@ -166,7 +166,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
* Make sure the item is not in the index if it is not in * Make sure the item is not in the index if it is not in
* archive or withwrawn. * archive or withwrawn.
*/ */
unIndexContent(context, handle); unIndexContent(context, item);
log.info("Removed Item: " + handle + " from Index"); log.info("Removed Item: " + handle + " from Index");
} }
break; break;

View File

@@ -275,7 +275,7 @@ public class DSIndexer
{ {
try try
{ {
IndexingTask task = prepareIndexingTask(dso, force); IndexingTask task = prepareIndexingTask(context, dso, force);
if (task != null) if (task != null)
{ {
processIndexingTask(task); processIndexingTask(task);
@@ -653,9 +653,9 @@ public class DSIndexer
} }
static IndexingTask prepareIndexingTask(DSpaceObject dso, boolean force) throws SQLException, IOException, DCInputsReaderException static IndexingTask prepareIndexingTask(Context context, DSpaceObject dso, boolean force) throws SQLException, IOException, DCInputsReaderException
{ {
String handle = dso.getHandle(); String handle = HandleManager.findHandle(context, dso);
Term term = new Term("handle", handle); Term term = new Term("handle", handle);
IndexingTask action = null; IndexingTask action = null;
switch (dso.getType()) switch (dso.getType())
@@ -668,7 +668,7 @@ public class DSIndexer
if (requiresIndexing(term, ((Item)dso).getLastModified()) || force) if (requiresIndexing(term, ((Item)dso).getLastModified()) || force)
{ {
log.info("Writing Item: " + handle + " to Index"); log.info("Writing Item: " + handle + " to Index");
action = new IndexingTask(IndexingTask.Action.UPDATE, term, buildDocumentForItem((Item)dso)); action = new IndexingTask(IndexingTask.Action.UPDATE, term, buildDocumentForItem(context, (Item)dso));
} }
} }
else else
@@ -1041,9 +1041,9 @@ public class DSIndexer
* @throws SQLException * @throws SQLException
* @throws IOException * @throws IOException
*/ */
private static Document buildDocumentForItem(Item item) throws SQLException, IOException, DCInputsReaderException private static Document buildDocumentForItem(Context context, Item item) throws SQLException, IOException, DCInputsReaderException
{ {
String handle = item.getHandle(); String handle = HandleManager.findHandle(context, item);
// get the location string (for searching by collection & community) // get the location string (for searching by collection & community)
String location = buildItemLocationString(item); String location = buildItemLocationString(item);

View File

@@ -50,6 +50,7 @@ public class VersioningConsumer implements Consumer {
if(previous != null){ if(previous != null){
Item previousItem = previous.getItem(); Item previousItem = previous.getItem();
if(previousItem != null){ if(previousItem != null){
previousItem.setArchived(false);
itemsToProcess.add(previousItem); itemsToProcess.add(previousItem);
//Fire a new modify event for our previous item //Fire a new modify event for our previous item
//Due to the need to reindex the item in the search & browse index we need to fire a new event //Due to the need to reindex the item in the search & browse index we need to fire a new event
@@ -66,7 +67,6 @@ public class VersioningConsumer implements Consumer {
for(Item item : itemsToProcess){ for(Item item : itemsToProcess){
ctx.turnOffAuthorisationSystem(); ctx.turnOffAuthorisationSystem();
try { try {
item.setArchived(false);
item.update(); item.update();
} finally { } finally {
ctx.restoreAuthSystemState(); ctx.restoreAuthSystemState();

View File

@@ -508,7 +508,7 @@
<field name="discoverable" type="string" indexed="true" stored="true" omitNorms="true" /> <field name="discoverable" type="string" indexed="true" stored="true" omitNorms="true" />
<field name="read" type="string" indexed="true" stored="true" omitNorms="true" /> <field name="read" type="string" indexed="true" stored="true" omitNorms="true" multiValued="true" />
<!-- Community and collection hierarchy of the Item of interest (candidate for hierarchical facetting ) --> <!-- Community and collection hierarchy of the Item of interest (candidate for hierarchical facetting ) -->
<field name="location" type="lowerCaseSort" indexed="true" stored="true" multiValued="true" required="false" omitNorms="true" /> <field name="location" type="lowerCaseSort" indexed="true" stored="true" multiValued="true" required="false" omitNorms="true" />