ALF-9611 RSOLR 049: Share works against SOLR

- mostly working with bugs raised or the issues found
- ALF-9627 	RSOLR 049: Support for TAG list - simple field facettting
  - was not required. Facetting alpha is there (limits not set and need to go into JSON) - added to result set
- ALF-9628 	RSOLR 049: HTTPClient pooling and sharing by query
  - pooled for query, one reused instance for each tracker (could be shared)
- ALF-9629 	RSOLR 049: Support for PARENT field and start of PATH rebuilding other index tracking (group and site search)
  - done - also started PATH change and returns other data as not yet finished (QNAME is the most obvious)
  - fixed up and tidied query generation for index tokenisation mode form the model and what the query would like

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29585 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2011-08-05 19:43:05 +00:00
parent 4a8f8b7c2f
commit 37f19ecf45
17 changed files with 304 additions and 22 deletions

View File

@@ -32,7 +32,7 @@ public class MetaDataResultsFilter
private boolean includeAclId = true;
private boolean includeOwner = true;
private boolean includePaths = true;
private boolean includeAssociations = false;
private boolean includeParentAssociations = true;
private boolean includeChildAssociations = true;
private boolean includeNodeRef = true;
@@ -52,13 +52,13 @@ public class MetaDataResultsFilter
{
this.includeNodeRef = includeNodeRef;
}
public boolean getIncludeAssociations()
public boolean getIncludeParentAssociations()
{
return includeAssociations;
return includeParentAssociations;
}
public void setIncludeAssociations(boolean includeAssociations)
public void setIncludeParentAssociations(boolean includeParentAssociations)
{
this.includeAssociations = includeAssociations;
this.includeParentAssociations = includeParentAssociations;
}
public boolean getIncludeProperties()
{

View File

@@ -23,6 +23,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.zip.CRC32;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -43,9 +44,10 @@ public class NodeMetaData
private Long aclId;
private Map<QName, Serializable> properties;
private Set<QName> aspects;
// private List<Path> paths;
private Collection<Pair<Path, QName>> paths;
private List<ChildAssociationRef> childAssocs;
private List<ChildAssociationRef> parentAssocs;
private Long parentAssocsCrc;
public String getOwner()
{
@@ -119,6 +121,23 @@ public class NodeMetaData
{
this.childAssocs = childAssocs;
}
/**
* @param parentAssocs
* @param crc
*/
public void setParentAssocs(List<ChildAssociationRef> parentAssocs, Long parentAssocsCrc)
{
this.parentAssocs = parentAssocs;
this.parentAssocsCrc = parentAssocsCrc;
}
public List<ChildAssociationRef> getParentAssocs()
{
return parentAssocs;
}
public Long getParentAssocsCrc()
{
return parentAssocsCrc;
}
}

View File

@@ -23,6 +23,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -31,11 +32,13 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.zip.CRC32;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.dictionary.CompiledModel;
import org.alfresco.repo.dictionary.DictionaryDAO;
import org.alfresco.repo.dictionary.DictionaryDAOImpl;
import org.alfresco.repo.domain.CrcHelper;
import org.alfresco.repo.domain.node.Node;
import org.alfresco.repo.domain.node.NodeDAO;
import org.alfresco.repo.domain.node.NodeDAO.ChildAssocRefQueryCallback;
@@ -465,7 +468,7 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
boolean includeAspects = (resultFilter == null ? true : resultFilter.getIncludeAspects());
boolean includePaths = (resultFilter == null ? true : resultFilter.getIncludePaths());
boolean includeNodeRef = (resultFilter == null ? true : resultFilter.getIncludeNodeRef());
boolean includeAssociations = (resultFilter == null ? true : resultFilter.getIncludeAssociations());
boolean includeParentAssociations = (resultFilter == null ? true : resultFilter.getIncludeParentAssociations());
boolean includeChildAssociations = (resultFilter == null ? true : resultFilter.getIncludeChildAssociations());
boolean includeOwner = (resultFilter == null ? true : resultFilter.getIncludeOwner());
@@ -554,7 +557,7 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
nodeMetaData.setChildAssocs(childAssocs);
}
if(includeAssociations)
if(includeParentAssociations)
{
final List<ChildAssociationRef> parentAssocs = new ArrayList<ChildAssociationRef>(100);
nodeDAO.getParentAssocs(nodeId, null, null, null, new ChildAssocRefQueryCallback()
@@ -578,6 +581,20 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
{
}
});
CRC32 crc = new CRC32();
for(ChildAssociationRef car : parentAssocs)
{
try
{
crc.update(car.toString().getBytes("UTF-8"));
}
catch (UnsupportedEncodingException e)
{
throw new RuntimeException("UTF-8 encoding is not supported");
}
}
nodeMetaData.setParentAssocs(parentAssocs, crc.getValue());
// TODO non-child associations
// Collection<Pair<Long, AssociationRef>> sourceAssocs = nodeDAO.getSourceNodeAssocs(nodeId);

View File

@@ -267,7 +267,7 @@ public class SOLRTrackingComponentTest extends TestCase
NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters();
nodeMetaDataParams.setNodeIds(st.getNodeIds());
MetaDataResultsFilter filter = new MetaDataResultsFilter();
filter.setIncludeAssociations(false);
filter.setIncludeParentAssociations(false);
//filter.setIncludePaths(false);
filter.setIncludeChildAssociations(false);
getNodeMetaData(nodeMetaDataParams, filter, st);