mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-09-24 14:31:29 +00:00
Merge branch 'feature/SEARCH-1702_SolrInformationServer_withoutContentStore' of https://git.alfresco.com/search_discovery/insightengine into feature/SEARCH-1702_SolrInformationServer_withoutContentStore
This commit is contained in:
@@ -1738,7 +1738,10 @@ public class SolrInformationServer implements InformationServer
|
|||||||
docRef.tenant,
|
docRef.tenant,
|
||||||
docRef.aclId,
|
docRef.aclId,
|
||||||
docRef.dbId));
|
docRef.dbId));
|
||||||
|
|
||||||
|
if (docRef.optionalBag.containsKey(CONTENT_LOCALE)) {
|
||||||
addContentToDoc(docRef, doc, docRef.dbId);
|
addContentToDoc(docRef, doc, docRef.dbId);
|
||||||
|
}
|
||||||
|
|
||||||
LOGGER.debug("Text content of Document DBID={} has been updated (not yet indexed)", docRef.dbId);
|
LOGGER.debug("Text content of Document DBID={} has been updated (not yet indexed)", docRef.dbId);
|
||||||
|
|
||||||
@@ -1748,6 +1751,7 @@ public class SolrInformationServer implements InformationServer
|
|||||||
.map(Long::parseLong)
|
.map(Long::parseLong)
|
||||||
.orElse(CONTENT_UPDATED_MARKER);
|
.orElse(CONTENT_UPDATED_MARKER);
|
||||||
|
|
||||||
|
|
||||||
markAsContentInSynch(doc, latestAppliedVersionId);
|
markAsContentInSynch(doc, latestAppliedVersionId);
|
||||||
|
|
||||||
// Add to index
|
// Add to index
|
||||||
@@ -2288,8 +2292,8 @@ public class SolrInformationServer implements InformationServer
|
|||||||
private static void markAsContentInSynch(SolrInputDocument document, Long id)
|
private static void markAsContentInSynch(SolrInputDocument document, Long id)
|
||||||
{
|
{
|
||||||
long contentVersionId = ofNullable(id).orElse(CONTENT_UPDATED_MARKER);
|
long contentVersionId = ofNullable(id).orElse(CONTENT_UPDATED_MARKER);
|
||||||
document.setField(LATEST_APPLIED_CONTENT_VERSION_ID, contentVersionId);
|
document.addField(LATEST_APPLIED_CONTENT_VERSION_ID, contentVersionId);
|
||||||
document.setField(LAST_INCOMING_CONTENT_VERSION_ID, contentVersionId);
|
document.addField(LAST_INCOMING_CONTENT_VERSION_ID, contentVersionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2372,22 +2376,16 @@ public class SolrInformationServer implements InformationServer
|
|||||||
{
|
{
|
||||||
insertContentUpdateMarker(document, propertyValue);
|
insertContentUpdateMarker(document, propertyValue);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
markAsContentInSynch(document, propertyValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addContentToDoc(TenantAclIdDbId docRef, SolrInputDocument doc, long dbId) throws AuthenticationException, IOException
|
private void addContentToDoc(TenantAclIdDbId docRef, SolrInputDocument doc, long dbId) throws AuthenticationException, IOException
|
||||||
{
|
{
|
||||||
if (docRef.optionalBag.containsKey(CONTENT_LOCALE))
|
|
||||||
{
|
|
||||||
String locale = (String) docRef.optionalBag.get(CONTENT_LOCALE);
|
String locale = (String) docRef.optionalBag.get(CONTENT_LOCALE);
|
||||||
String qNamePart = CONTENT_LOCALE.substring(AlfrescoSolrDataModel.CONTENT_S_LOCALE_PREFIX.length());
|
String qNamePart = CONTENT_LOCALE.substring(AlfrescoSolrDataModel.CONTENT_S_LOCALE_PREFIX.length());
|
||||||
QName propertyQName = QName.createQName(qNamePart);
|
QName propertyQName = QName.createQName(qNamePart);
|
||||||
addContentPropertyToDocUsingAlfrescoRepository(doc, propertyQName, dbId, locale);
|
addContentPropertyToDocUsingAlfrescoRepository(doc, propertyQName, dbId, locale);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the text content from the given API response.
|
* Extracts the text content from the given API response.
|
||||||
@@ -3086,7 +3084,9 @@ public class SolrInformationServer implements InformationServer
|
|||||||
metadata.getAclId(),
|
metadata.getAclId(),
|
||||||
metadata.getId()));
|
metadata.getId()));
|
||||||
doc.setField(FIELD_VERSION, 0);
|
doc.setField(FIELD_VERSION, 0);
|
||||||
doc.setField(FIELD_DBID, metadata.getId());
|
|
||||||
|
// Here is used add in order to make sure that the atomic update happens
|
||||||
|
doc.addField(FIELD_DBID, metadata.getId());
|
||||||
doc.setField(FIELD_LID, metadata.getNodeRef().toString());
|
doc.setField(FIELD_LID, metadata.getNodeRef().toString());
|
||||||
doc.setField(FIELD_INTXID, metadata.getTxnId());
|
doc.setField(FIELD_INTXID, metadata.getTxnId());
|
||||||
doc.setField(FIELD_DOC_TYPE, docType);
|
doc.setField(FIELD_DOC_TYPE, docType);
|
||||||
@@ -3094,6 +3094,7 @@ public class SolrInformationServer implements InformationServer
|
|||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void updatePathRelatedFields(NodeMetaData nodeMetaData, SolrInputDocument doc)
|
private void updatePathRelatedFields(NodeMetaData nodeMetaData, SolrInputDocument doc)
|
||||||
{
|
{
|
||||||
clearFields(doc, FIELD_PATH, FIELD_SITE, FIELD_TAG, FIELD_TAG_SUGGEST, FIELD_APATH, FIELD_ANAME);
|
clearFields(doc, FIELD_PATH, FIELD_SITE, FIELD_TAG, FIELD_TAG_SUGGEST, FIELD_APATH, FIELD_ANAME);
|
||||||
@@ -3214,18 +3215,18 @@ public class SolrInformationServer implements InformationServer
|
|||||||
NodeMetaDataParameters nmdp = new NodeMetaDataParameters();
|
NodeMetaDataParameters nmdp = new NodeMetaDataParameters();
|
||||||
nmdp.setFromNodeId(childId);
|
nmdp.setFromNodeId(childId);
|
||||||
nmdp.setToNodeId(childId);
|
nmdp.setToNodeId(childId);
|
||||||
nmdp.setIncludeAclId(false);
|
nmdp.setIncludeAclId(true);
|
||||||
nmdp.setIncludeAspects(false);
|
nmdp.setIncludeAspects(false);
|
||||||
nmdp.setIncludeChildAssociations(false);
|
nmdp.setIncludeChildAssociations(false);
|
||||||
nmdp.setIncludeChildIds(true);
|
nmdp.setIncludeChildIds(true);
|
||||||
nmdp.setIncludeNodeRef(false);
|
nmdp.setIncludeNodeRef(true);
|
||||||
nmdp.setIncludeOwner(false);
|
nmdp.setIncludeOwner(false);
|
||||||
nmdp.setIncludeParentAssociations(false);
|
nmdp.setIncludeParentAssociations(false);
|
||||||
|
|
||||||
// We only care about the path and ancestors (which is included) for this case
|
// We only care about the path and ancestors (which is included) for this case
|
||||||
nmdp.setIncludePaths(true);
|
nmdp.setIncludePaths(true);
|
||||||
nmdp.setIncludeProperties(false);
|
nmdp.setIncludeProperties(false);
|
||||||
nmdp.setIncludeType(false);
|
nmdp.setIncludeType(true);
|
||||||
nmdp.setIncludeTxnId(true);
|
nmdp.setIncludeTxnId(true);
|
||||||
|
|
||||||
// Gets only one
|
// Gets only one
|
||||||
@@ -3247,28 +3248,6 @@ public class SolrInformationServer implements InformationServer
|
|||||||
|
|
||||||
LOGGER.debug("Cascade update child doc {}", childId);
|
LOGGER.debug("Cascade update child doc {}", childId);
|
||||||
|
|
||||||
// Gets the document that we have from the content store and updates it
|
|
||||||
//String fixedTenantDomain = AlfrescoSolrDataModel.getTenantId(nodeMetaData.getTenantDomain());
|
|
||||||
|
|
||||||
// // TODO: REMOVE!
|
|
||||||
// if (document == null)
|
|
||||||
// {
|
|
||||||
// document = recreateSolrDoc(nodeMetaData.getId(), fixedTenantDomain);
|
|
||||||
//
|
|
||||||
// // if we did not build it again it has been deleted
|
|
||||||
// // We do the delete here to avoid doing this again if it for some reason persists in teh index
|
|
||||||
// // This is a work around for ACE-3228/ACE-3258 and the way stores are expunged when deleting a tenant
|
|
||||||
// if (document == null)
|
|
||||||
// {
|
|
||||||
// deleteNode(processor, request, nodeMetaData.getId());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: ATOMIC UPDATE
|
|
||||||
// if (document != null)
|
|
||||||
// {
|
|
||||||
|
|
||||||
SolrInputDocument document = basicDocument(nodeMetaData, DOC_TYPE_NODE, PartialSolrInputDocument::new);
|
SolrInputDocument document = basicDocument(nodeMetaData, DOC_TYPE_NODE, PartialSolrInputDocument::new);
|
||||||
|
|
||||||
AddUpdateCommand addDocCmd = new AddUpdateCommand(request);
|
AddUpdateCommand addDocCmd = new AddUpdateCommand(request);
|
||||||
@@ -3280,11 +3259,7 @@ public class SolrInformationServer implements InformationServer
|
|||||||
updateAncestorRelatedFields(nodeMetaData, document);
|
updateAncestorRelatedFields(nodeMetaData, document);
|
||||||
|
|
||||||
processor.processAdd(addDocCmd);
|
processor.processAdd(addDocCmd);
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// LOGGER.debug("No child doc found to update {}", childId);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user