mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-07 18:25:23 +00:00
Merged BRANCHES/DEV to HEAD:
32284: MT/Solr: fix intermittent "My Favorites" git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32315 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
aec3763677
commit
e60dc76152
@ -31,9 +31,6 @@
|
|||||||
|
|
||||||
<bean id="search.solrQueryHTTPCLient" class="org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient" init-method="init">
|
<bean id="search.solrQueryHTTPCLient" class="org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient" init-method="init">
|
||||||
<property name="httpClientFactory" ref="solrHttpClientFactory"/>
|
<property name="httpClientFactory" ref="solrHttpClientFactory"/>
|
||||||
<property name="nodeDAO">
|
|
||||||
<ref bean="nodeDAO" />
|
|
||||||
</property>
|
|
||||||
<property name="nodeService">
|
<property name="nodeService">
|
||||||
<ref bean="mlAwareNodeService" />
|
<ref bean="mlAwareNodeService" />
|
||||||
</property>
|
</property>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@ -24,7 +24,6 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.repo.domain.node.NodeDAO;
|
|
||||||
import org.alfresco.repo.search.SimpleResultSetMetaData;
|
import org.alfresco.repo.search.SimpleResultSetMetaData;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@ -37,7 +36,6 @@ import org.alfresco.service.cmr.search.ResultSetMetaData;
|
|||||||
import org.alfresco.service.cmr.search.ResultSetRow;
|
import org.alfresco.service.cmr.search.ResultSetRow;
|
||||||
import org.alfresco.service.cmr.search.SearchParameters;
|
import org.alfresco.service.cmr.search.SearchParameters;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
import org.apache.solr.client.solrj.response.FacetField;
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@ -47,8 +45,6 @@ import org.json.JSONObject;
|
|||||||
*/
|
*/
|
||||||
public class SolrJSONResultSet implements ResultSet
|
public class SolrJSONResultSet implements ResultSet
|
||||||
{
|
{
|
||||||
private NodeDAO nodeDAO;
|
|
||||||
|
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
private ArrayList<Pair<Long, Float>> page;
|
private ArrayList<Pair<Long, Float>> page;
|
||||||
@ -73,10 +69,9 @@ public class SolrJSONResultSet implements ResultSet
|
|||||||
* Detached result set based on that provided
|
* Detached result set based on that provided
|
||||||
* @param resultSet
|
* @param resultSet
|
||||||
*/
|
*/
|
||||||
public SolrJSONResultSet(JSONObject json, NodeDAO nodeDAO, SearchParameters searchParameters, NodeService nodeService)
|
public SolrJSONResultSet(JSONObject json, SearchParameters searchParameters, NodeService nodeService)
|
||||||
{
|
{
|
||||||
// Note all properties are returned as multi-valued from the WildcardField "*" definition in the SOLR schema.xml
|
// Note all properties are returned as multi-valued from the WildcardField "*" definition in the SOLR schema.xml
|
||||||
this.nodeDAO = nodeDAO;
|
|
||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
this.resultSetMetaData = new SimpleResultSetMetaData(LimitBy.UNLIMITED, PermissionEvaluationMode.EAGER, searchParameters);
|
this.resultSetMetaData = new SimpleResultSetMetaData(LimitBy.UNLIMITED, PermissionEvaluationMode.EAGER, searchParameters);
|
||||||
try
|
try
|
||||||
@ -184,18 +179,17 @@ public class SolrJSONResultSet implements ResultSet
|
|||||||
@Override
|
@Override
|
||||||
public ChildAssociationRef getChildAssocRef(int n)
|
public ChildAssociationRef getChildAssocRef(int n)
|
||||||
{
|
{
|
||||||
Pair<Long, ChildAssociationRef> primaryParentAssoc = nodeDAO.getPrimaryParentAssoc(page.get(n).getFirst());
|
ChildAssociationRef primaryParentAssoc = nodeService.getPrimaryParent(getNodeRef(n));
|
||||||
if(primaryParentAssoc != null)
|
if(primaryParentAssoc != null)
|
||||||
{
|
{
|
||||||
return primaryParentAssoc.getSecond();
|
return primaryParentAssoc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.alfresco.service.cmr.search.ResultSetSPI#getChildAssocRefs()
|
* @see org.alfresco.service.cmr.search.ResultSetSPI#getChildAssocRefs()
|
||||||
@ -219,10 +213,10 @@ public class SolrJSONResultSet implements ResultSet
|
|||||||
public NodeRef getNodeRef(int n)
|
public NodeRef getNodeRef(int n)
|
||||||
{
|
{
|
||||||
// TODO: lost nodes?
|
// TODO: lost nodes?
|
||||||
Pair<Long, NodeRef> nodePair = nodeDAO.getNodePair(page.get(n).getFirst());
|
NodeRef nodeRef = nodeService.getNodeRef(page.get(n).getFirst());
|
||||||
if(nodePair != null)
|
if(nodeRef != null)
|
||||||
{
|
{
|
||||||
return nodePair.getSecond();
|
return nodeRef;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.httpclient.HttpClientFactory;
|
import org.alfresco.httpclient.HttpClientFactory;
|
||||||
import org.alfresco.repo.domain.node.NodeDAO;
|
|
||||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParserException;
|
import org.alfresco.repo.search.impl.lucene.LuceneQueryParserException;
|
||||||
import org.alfresco.repo.search.impl.lucene.SolrJSONResultSet;
|
import org.alfresco.repo.search.impl.lucene.SolrJSONResultSet;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
@ -70,8 +69,6 @@ public class SolrQueryHTTPClient
|
|||||||
{
|
{
|
||||||
static Log s_logger = LogFactory.getLog(SolrQueryHTTPClient.class);
|
static Log s_logger = LogFactory.getLog(SolrQueryHTTPClient.class);
|
||||||
|
|
||||||
private NodeDAO nodeDAO;
|
|
||||||
|
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
@ -104,15 +101,10 @@ public class SolrQueryHTTPClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setHttpClientFactory(HttpClientFactory httpClientFactory)
|
public void setHttpClientFactory(HttpClientFactory httpClientFactory)
|
||||||
{
|
|
||||||
this.httpClientFactory = httpClientFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNodeDAO(NodeDAO nodeDAO)
|
|
||||||
{
|
{
|
||||||
this.nodeDAO = nodeDAO;
|
this.httpClientFactory = httpClientFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNodeService(NodeService nodeService)
|
public void setNodeService(NodeService nodeService)
|
||||||
{
|
{
|
||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
@ -344,7 +336,7 @@ public class SolrQueryHTTPClient
|
|||||||
Reader reader = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream()));
|
Reader reader = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream()));
|
||||||
// TODO - replace with streaming-based solution e.g. SimpleJSON ContentHandler
|
// TODO - replace with streaming-based solution e.g. SimpleJSON ContentHandler
|
||||||
JSONObject json = new JSONObject(new JSONTokener(reader));
|
JSONObject json = new JSONObject(new JSONTokener(reader));
|
||||||
SolrJSONResultSet results = new SolrJSONResultSet(json, nodeDAO, searchParameters, nodeService);
|
SolrJSONResultSet results = new SolrJSONResultSet(json, searchParameters, nodeService);
|
||||||
if (s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
s_logger.debug("Sent :" + url);
|
s_logger.debug("Sent :" + url);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user