Fix for ALF-11001 Index check is not aware of cm:indexControl:isIndexed

- also fixed index checker to respect the current live index subsytem and not the property (which may be over ridden by sub-system configuration)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32062 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2011-11-17 15:29:58 +00:00
parent 1cd461a4cb
commit 7f7224c2f5
4 changed files with 42 additions and 8 deletions

View File

@@ -103,8 +103,8 @@
<property name="extensionName">
<value>search</value>
</property>
<property name="searchSubsystem">
<value>${index.subsystem.name}</value>
<property name="searchSubsystemSwitchableApplicationContextFactory">
<ref bean="Search" />
</property>
<property name="serviceRegistry">
<ref bean="ServiceRegistry"/>

View File

@@ -28,6 +28,7 @@ import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.management.subsystems.SwitchableApplicationContextFactory;
import org.alfresco.repo.model.Repository;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.ContentReader;
@@ -77,7 +78,7 @@ public class Search extends BaseScopableProcessorExtension
/** Repository helper */
protected Repository repository;
private String searchSubsystem;
private SwitchableApplicationContextFactory searchSubsystem;
/**
* Set the default store reference
@@ -114,7 +115,7 @@ public class Search extends BaseScopableProcessorExtension
this.repository = repository;
}
public void setSearchSubsystem(String searchSubsystem)
public void setSearchSubsystemSwitchableApplicationContextFactory(SwitchableApplicationContextFactory searchSubsystem)
{
this.searchSubsystem = searchSubsystem;
}
@@ -123,7 +124,7 @@ public class Search extends BaseScopableProcessorExtension
public String getSearchSubsystem()
{
return searchSubsystem;
return (searchSubsystem == null) ? "" : searchSubsystem.getCurrentSourceBeanName();
}
/**

View File

@@ -50,6 +50,11 @@ public class SwitchableApplicationContextFactory extends AbstractPropertyBackedB
this.sourceBeanName = sourceBeanName;
}
public String getCurrentSourceBeanName()
{
return getState(false).getProperty(SwitchableApplicationContextFactory.SOURCE_BEAN_PROPERTY);
}
/*
* (non-Javadoc)
* @see org.alfresco.repo.management.subsystems.ApplicationContextFactory#getApplicationContext()

View File

@@ -19,6 +19,7 @@
package org.alfresco.repo.node.index;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
@@ -56,6 +57,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.repository.NodeRef.Status;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.ResultSetRow;
import org.alfresco.service.cmr.search.SearchParameters;
@@ -450,7 +452,7 @@ public abstract class AbstractReindexComponent implements IndexRecovery
// Establish the number of deletes and updates for this storeRef
List<NodeRef> deletedNodes = new LinkedList<NodeRef>();
int updateCount = 0;
boolean hasUpdates = false;
for (NodeRef.Status nodeStatus : storeStatuses)
{
if (nodeStatus.isDeleted())
@@ -459,7 +461,33 @@ public abstract class AbstractReindexComponent implements IndexRecovery
}
else
{
updateCount++;
if(!hasUpdates)
{
Serializable serIsIndexed = nodeService.getProperty(nodeStatus.getNodeRef(), ContentModel.PROP_IS_INDEXED);
if(serIsIndexed == null)
{
hasUpdates = true;
}
else
{
Boolean isIndexed = DefaultTypeConverter.INSTANCE.convert(Boolean.class, serIsIndexed);
if(isIndexed == null)
{
hasUpdates = true;
}
else
{
if(isIndexed.booleanValue())
{
hasUpdates = true;
}
else
{
// Still do not know if there is anything to check ....
}
}
}
}
}
}
@@ -472,7 +500,7 @@ public abstract class AbstractReindexComponent implements IndexRecovery
result = InIndex.NO;
break;
}
if (updateCount > 0)
if (hasUpdates)
{
// Check the index
if (isTxnIdPresentInIndex(storeRef, txn))