Search in sources :

Example 16 with StringPropertyValue

use of org.alfresco.solr.client.StringPropertyValue in project SearchServices by Alfresco.

the class AuthDataLoad method setup.

@BeforeClass
public static void setup() throws Exception {
    // Start test haness
    initAlfrescoCore("schema.xml");
    // Root
    NodeRef rootNodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    addStoreRoot(h.getCore(), dataModel, rootNodeRef, 1, 1, 1, 1);
    // rsp.add("StoreRootNode", 1);
    // Base
    HashMap<QName, PropertyValue> baseFolderProperties = new HashMap<QName, PropertyValue>();
    baseFolderProperties.put(ContentModel.PROP_NAME, new StringPropertyValue("Base Folder"));
    NodeRef baseFolderNodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    QName baseFolderQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "baseFolder");
    ChildAssociationRef n01CAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, baseFolderQName, baseFolderNodeRef, true, 0);
    addNode(h.getCore(), dataModel, 1, 2, 1, ContentModel.TYPE_FOLDER, null, baseFolderProperties, null, "andy", new ChildAssociationRef[] { n01CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + baseFolderQName.toString() }, baseFolderNodeRef, true);
    // Folders
    HashMap<QName, PropertyValue> folder00Properties = new HashMap<QName, PropertyValue>();
    folder00Properties.put(ContentModel.PROP_NAME, new StringPropertyValue("Folder 0"));
    NodeRef folder00NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    QName folder00QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "Folder 0");
    ChildAssociationRef folder00CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, baseFolderNodeRef, folder00QName, folder00NodeRef, true, 0);
    addNode(h.getCore(), dataModel, 1, 3, 1, ContentModel.TYPE_FOLDER, null, folder00Properties, null, "andy", new ChildAssociationRef[] { folder00CAR }, new NodeRef[] { baseFolderNodeRef, rootNodeRef }, new String[] { "/" + baseFolderQName.toString() + "/" + folder00QName.toString() }, folder00NodeRef, true);
    for (long i = 0; i < count; i++) {
        addAcl(h.getCore(), dataModel, 10 + (int) i, 10 + (int) i, (int) (i % maxReader), (int) maxReader);
        HashMap<QName, PropertyValue> content00Properties = new HashMap<QName, PropertyValue>();
        MLTextPropertyValue desc00 = new MLTextPropertyValue();
        desc00.addValue(Locale.ENGLISH, "Doc " + i);
        desc00.addValue(Locale.US, "Doc " + i);
        content00Properties.put(ContentModel.PROP_DESCRIPTION, desc00);
        content00Properties.put(ContentModel.PROP_TITLE, desc00);
        content00Properties.put(ContentModel.PROP_CONTENT, new ContentPropertyValue(Locale.UK, 0l, "UTF-8", "text/plain", null));
        content00Properties.put(ContentModel.PROP_NAME, new StringPropertyValue("Doc " + i));
        content00Properties.put(ContentModel.PROP_CREATOR, new StringPropertyValue("Test"));
        content00Properties.put(ContentModel.PROP_MODIFIER, new StringPropertyValue("Test"));
        content00Properties.put(ContentModel.PROP_VERSION_LABEL, new StringPropertyValue("1.0"));
        content00Properties.put(ContentModel.PROP_OWNER, new StringPropertyValue("Test"));
        Date date00 = new Date();
        content00Properties.put(ContentModel.PROP_CREATED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, date00)));
        content00Properties.put(ContentModel.PROP_MODIFIED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, date00)));
        HashMap<QName, String> content00Content = new HashMap<QName, String>();
        content00Content.put(ContentModel.PROP_CONTENT, "Test doc number " + i);
        NodeRef content00NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
        QName content00QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "Doc-" + i);
        ChildAssociationRef content00CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, folder00NodeRef, content00QName, content00NodeRef, true, 0);
        addNode(h.getCore(), dataModel, 1, 10 + (int) i, 10 + (int) i, ContentModel.TYPE_CONTENT, new QName[] { ContentModel.ASPECT_OWNABLE, ContentModel.ASPECT_TITLED }, content00Properties, content00Content, "andy", new ChildAssociationRef[] { content00CAR }, new NodeRef[] { baseFolderNodeRef, rootNodeRef, folder00NodeRef }, new String[] { "/" + baseFolderQName.toString() + "/" + folder00QName.toString() + "/" + content00QName.toString() }, content00NodeRef, false);
    }
    h.getCore().getUpdateHandler().commit(new CommitUpdateCommand(req(), false));
}
Also used : StoreRef(org.alfresco.service.cmr.repository.StoreRef) StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) PropertyValue(org.alfresco.solr.client.PropertyValue) StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) ContentPropertyValue(org.alfresco.solr.client.ContentPropertyValue) CommitUpdateCommand(org.apache.solr.update.CommitUpdateCommand) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) Date(java.util.Date) ContentPropertyValue(org.alfresco.solr.client.ContentPropertyValue) NodeRef(org.alfresco.service.cmr.repository.NodeRef) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) BeforeClass(org.junit.BeforeClass)

Example 17 with StringPropertyValue

use of org.alfresco.solr.client.StringPropertyValue in project SearchServices by Alfresco.

the class SolrInformationServer method addPropertiesToDoc.

static void addPropertiesToDoc(Map<QName, PropertyValue> properties, boolean isContentIndexedForNode, SolrInputDocument newDoc, SolrInputDocument cachedDoc, boolean transformContentFlag) throws IOException {
    for (QName propertyQName : properties.keySet()) {
        newDoc.addField(FIELD_PROPERTIES, propertyQName.toString());
        newDoc.addField(FIELD_PROPERTIES, propertyQName.getPrefixString());
        PropertyValue value = properties.get(propertyQName);
        // System.out.println("####### indexing prop:"+propertyQName.toString()+":"+value.toString());
        if (value != null) {
            if (value instanceof StringPropertyValue) {
                for (FieldInstance field : AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(propertyQName).getFields()) {
                    // System.out.println("####### field:"+field.getField()+":"+value.toString());
                    addStringPropertyToDoc(newDoc, field, (StringPropertyValue) value, properties);
                }
            } else if (value instanceof MLTextPropertyValue) {
                for (FieldInstance field : AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(propertyQName).getFields()) {
                    addMLTextPropertyToDoc(newDoc, field, (MLTextPropertyValue) value);
                }
            } else if (value instanceof ContentPropertyValue) {
                boolean transform = transformContentFlag;
                if (!isContentIndexedForNode) {
                    transform = false;
                }
                addContentPropertyToDocUsingCache(newDoc, cachedDoc, propertyQName, (ContentPropertyValue) value, transform);
            } else if (value instanceof MultiPropertyValue) {
                MultiPropertyValue typedValue = (MultiPropertyValue) value;
                for (PropertyValue singleValue : typedValue.getValues()) {
                    if (singleValue instanceof StringPropertyValue) {
                        for (FieldInstance field : AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(propertyQName).getFields()) {
                            addStringPropertyToDoc(newDoc, field, (StringPropertyValue) singleValue, properties);
                        }
                    } else if (singleValue instanceof MLTextPropertyValue) {
                        for (FieldInstance field : AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(propertyQName).getFields()) {
                            addMLTextPropertyToDoc(newDoc, field, (MLTextPropertyValue) singleValue);
                        }
                    } else if (singleValue instanceof ContentPropertyValue) {
                        boolean transform = transformContentFlag;
                        if (!isContentIndexedForNode) {
                            transform = false;
                        }
                        addContentPropertyToDocUsingCache(newDoc, cachedDoc, propertyQName, (ContentPropertyValue) singleValue, transform);
                    }
                }
            }
        } else {
            // NULL property
            newDoc.addField(FIELD_NULLPROPERTIES, propertyQName.toString());
        }
    }
}
Also used : StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) MultiPropertyValue(org.alfresco.solr.client.MultiPropertyValue) QName(org.alfresco.service.namespace.QName) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) ContentPropertyValue(org.alfresco.solr.client.ContentPropertyValue) MultiPropertyValue(org.alfresco.solr.client.MultiPropertyValue) PropertyValue(org.alfresco.solr.client.PropertyValue) FieldInstance(org.alfresco.solr.AlfrescoSolrDataModel.FieldInstance) ContentPropertyValue(org.alfresco.solr.client.ContentPropertyValue)

Example 18 with StringPropertyValue

use of org.alfresco.solr.client.StringPropertyValue in project SearchServices by Alfresco.

the class SolrInformationServer method indexNode.

@Override
public void indexNode(Node node, boolean overwrite) throws IOException, AuthenticationException, JSONException {
    SolrQueryRequest request = null;
    UpdateRequestProcessor processor = null;
    try {
        request = getLocalSolrQueryRequest();
        processor = this.core.getUpdateProcessingChain(null).createProcessor(request, new SolrQueryResponse());
        long start = System.nanoTime();
        if ((node.getStatus() == SolrApiNodeStatus.DELETED) || (node.getStatus() == SolrApiNodeStatus.NON_SHARD_DELETED) || (node.getStatus() == SolrApiNodeStatus.NON_SHARD_UPDATED) || (node.getStatus() == SolrApiNodeStatus.UNKNOWN)) {
            // fix up any secondary paths
            NodeMetaDataParameters nmdp = new NodeMetaDataParameters();
            nmdp.setFromNodeId(node.getId());
            nmdp.setToNodeId(node.getId());
            List<NodeMetaData> nodeMetaDatas;
            if ((node.getStatus() == SolrApiNodeStatus.DELETED) || (node.getStatus() == SolrApiNodeStatus.NON_SHARD_DELETED) || (node.getStatus() == SolrApiNodeStatus.NON_SHARD_UPDATED)) {
                // Fake the empty node metadata for this parent deleted node
                NodeMetaData nodeMetaData = createDeletedNodeMetaData(node);
                nodeMetaDatas = Collections.singletonList(nodeMetaData);
            } else {
                nodeMetaDatas = repositoryClient.getNodesMetaData(nmdp, Integer.MAX_VALUE);
            }
            NodeMetaData nodeMetaData = null;
            if (!nodeMetaDatas.isEmpty()) {
                nodeMetaData = nodeMetaDatas.get(0);
                if (!(nodeMetaData.getTxnId() > node.getTxnId())) {
                    if (node.getStatus() == SolrApiNodeStatus.DELETED) {
                        try {
                            // Lock the node to ensure that no other trackers work with this node until this code completes.
                            if (!spinLock(nodeMetaData.getId(), 120000)) {
                                // We haven't acquired the lock in over 2 minutes. This really shouldn't happen unless something has gone wrong.
                                throw new Exception("Unable to acquire lock on nodeId:" + nodeMetaData.getId());
                            }
                            solrContentStore.removeDocFromContentStore(nodeMetaData);
                        } finally {
                            unlock(nodeMetaData.getId());
                        }
                    }
                }
            // else, the node has moved on to a later transaction, and it will be indexed later
            }
            if (log.isDebugEnabled()) {
                log.debug(".. deleting");
            }
            deleteNode(processor, request, node);
        }
        if ((node.getStatus() == SolrApiNodeStatus.UPDATED) || (node.getStatus() == SolrApiNodeStatus.UNKNOWN) || (node.getStatus() == SolrApiNodeStatus.NON_SHARD_UPDATED)) {
            log.info(".. updating");
            long nodeId = node.getId();
            try {
                if (!spinLock(nodeId, 120000)) {
                    // We haven't acquired the lock in over 2 minutes. This really shouldn't happen unless something has gone wrong.
                    throw new Exception("Unable to acquire lock on nodeId:" + nodeId);
                }
                NodeMetaDataParameters nmdp = new NodeMetaDataParameters();
                nmdp.setFromNodeId(node.getId());
                nmdp.setToNodeId(node.getId());
                List<NodeMetaData> nodeMetaDatas = repositoryClient.getNodesMetaData(nmdp, Integer.MAX_VALUE);
                AddUpdateCommand addDocCmd = new AddUpdateCommand(request);
                addDocCmd.overwrite = overwrite;
                if (!nodeMetaDatas.isEmpty()) {
                    NodeMetaData nodeMetaData = nodeMetaDatas.get(0);
                    if (!(nodeMetaData.getTxnId() > node.getTxnId())) {
                    /*
                        if (mayHaveChildren(nodeMetaData))
                        {
                            cascadeUpdate(nodeMetaData, overwrite, request, processor);
                        }
            				 */
                    }
                    if (node.getTxnId() == Long.MAX_VALUE) {
                        // This is a re-index. We need to clear the txnId from the pr
                        this.cleanContentCache.remove(nodeMetaData.getTxnId());
                    }
                    if ((node.getStatus() == SolrApiNodeStatus.UPDATED) || (node.getStatus() == SolrApiNodeStatus.UNKNOWN)) {
                        // check index control
                        Map<QName, PropertyValue> properties = nodeMetaData.getProperties();
                        StringPropertyValue pValue = (StringPropertyValue) properties.get(ContentModel.PROP_IS_INDEXED);
                        if (pValue != null) {
                            Boolean isIndexed = Boolean.valueOf(pValue.getValue());
                            if (!isIndexed.booleanValue()) {
                                if (log.isDebugEnabled()) {
                                    log.debug(".. clearing unindexed");
                                }
                                deleteNode(processor, request, node);
                                SolrInputDocument doc = createNewDoc(nodeMetaData, DOC_TYPE_UNINDEXED_NODE);
                                solrContentStore.storeDocOnSolrContentStore(nodeMetaData, doc);
                                addDocCmd.solrDoc = doc;
                                processor.processAdd(addDocCmd);
                                long end = System.nanoTime();
                                this.trackerStats.addNodeTime(end - start);
                                return;
                            }
                        }
                        // Make sure any unindexed or error doc is removed.
                        if (log.isDebugEnabled()) {
                            log.debug(".. deleting node " + node.getId());
                        }
                        deleteNode(processor, request, node);
                        SolrInputDocument doc = createNewDoc(nodeMetaData, DOC_TYPE_NODE);
                        addToNewDocAndCache(nodeMetaData, doc);
                        addDocCmd.solrDoc = doc;
                        processor.processAdd(addDocCmd);
                    }
                }
            // Ends checking for a nodeMetaData
            } finally {
                unlock(nodeId);
            }
        }
        // Ends checking for updated or unknown node status
        long end = System.nanoTime();
        this.trackerStats.addNodeTime(end - start);
    } catch (Exception e) {
        log.warn("Node index failed and skipped for " + node.getId() + " in Tx " + node.getTxnId(), e);
        if (processor == null) {
            if (request == null) {
                request = getLocalSolrQueryRequest();
            }
            processor = this.core.getUpdateProcessingChain(null).createProcessor(request, new SolrQueryResponse());
        }
        if (log.isDebugEnabled()) {
            log.debug(".. deleting on exception");
        }
        deleteNode(processor, request, node);
        AddUpdateCommand addDocCmd = new AddUpdateCommand(request);
        addDocCmd.overwrite = overwrite;
        SolrInputDocument doc = new SolrInputDocument();
        doc.addField(FIELD_SOLR4_ID, PREFIX_ERROR + node.getId());
        doc.addField(FIELD_VERSION, "0");
        doc.addField(FIELD_DBID, node.getId());
        doc.addField(FIELD_INTXID, node.getTxnId());
        doc.addField(FIELD_EXCEPTION_MESSAGE, e.getMessage());
        doc.addField(FIELD_DOC_TYPE, DOC_TYPE_ERROR_NODE);
        StringWriter stringWriter = new StringWriter(4096);
        PrintWriter printWriter = new PrintWriter(stringWriter, true);
        try {
            e.printStackTrace(printWriter);
            String stack = stringWriter.toString();
            doc.addField(FIELD_EXCEPTION_STACK, stack.length() < 32766 ? stack : stack.substring(0, 32765));
        } finally {
            printWriter.close();
        }
        addDocCmd.solrDoc = doc;
        processor.processAdd(addDocCmd);
    } finally {
        if (processor != null) {
            processor.finish();
        }
        if (request != null) {
            request.close();
        }
    }
}
Also used : StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) NodeMetaData(org.alfresco.solr.client.NodeMetaData) QName(org.alfresco.service.namespace.QName) StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) ContentPropertyValue(org.alfresco.solr.client.ContentPropertyValue) MultiPropertyValue(org.alfresco.solr.client.MultiPropertyValue) PropertyValue(org.alfresco.solr.client.PropertyValue) JSONException(org.json.JSONException) AuthenticationException(org.alfresco.httpclient.AuthenticationException) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) SolrQueryRequest(org.apache.solr.request.SolrQueryRequest) SolrInputDocument(org.apache.solr.common.SolrInputDocument) StringWriter(java.io.StringWriter) UpdateRequestProcessor(org.apache.solr.update.processor.UpdateRequestProcessor) NodeMetaDataParameters(org.alfresco.solr.client.NodeMetaDataParameters) AddUpdateCommand(org.apache.solr.update.AddUpdateCommand) PrintWriter(java.io.PrintWriter)

Example 19 with StringPropertyValue

use of org.alfresco.solr.client.StringPropertyValue in project SearchServices by Alfresco.

the class SolrInformationServer method addFieldsToDoc.

private void addFieldsToDoc(NodeMetaData nodeMetaData, SolrInputDocument doc) {
    doc.addField(FIELD_TYPE, nodeMetaData.getType().toString());
    for (QName aspect : nodeMetaData.getAspects()) {
        doc.addField(FIELD_ASPECT, aspect.toString());
        if (aspect.equals(ContentModel.ASPECT_GEOGRAPHIC)) {
            StringPropertyValue latProp = ((StringPropertyValue) nodeMetaData.getProperties().get(ContentModel.PROP_LATITUDE));
            StringPropertyValue lonProp = ((StringPropertyValue) nodeMetaData.getProperties().get(ContentModel.PROP_LONGITUDE));
            if ((latProp != null) && (lonProp != null)) {
                String lat = latProp.getValue();
                String lon = lonProp.getValue();
                if ((lat != null) && (lon != null)) {
                    try {
                        double dLat = Double.parseDouble(lat);
                        double dLon = Double.parseDouble(lon);
                        if ((-90d <= dLat) && (dLat <= 90d) && (-180d <= dLon) && (dLon <= 180d)) {
                            doc.addField(FIELD_GEO, lat + ", " + lon);
                        }
                    } catch (NumberFormatException nfe) {
                        log.info("Skipping invalid geo data on node " + nodeMetaData.getId() + " -> (" + lat + ", " + lon + ")");
                    }
                } else {
                    log.info("Skipping missing geo data on " + nodeMetaData.getId());
                }
            } else {
                log.info("Skipping missing geo data on " + nodeMetaData.getId());
            }
        }
    }
    doc.addField(FIELD_ISNODE, "T");
    // FIELD_FTSSTATUS is set when adding content properties to indicate whether or not the cache is clean.
    doc.addField(FIELD_TENANT, AlfrescoSolrDataModel.getTenantId(nodeMetaData.getTenantDomain()));
    updatePathRelatedFields(nodeMetaData, doc);
    updateNamePathRelatedFields(nodeMetaData, doc);
    updateAncestorRelatedFields(nodeMetaData, doc);
    doc.addField(FIELD_PARENT_ASSOC_CRC, nodeMetaData.getParentAssocsCrc());
    if (nodeMetaData.getOwner() != null) {
        doc.addField(FIELD_OWNER, nodeMetaData.getOwner());
    }
    StringBuilder qNameBuffer = new StringBuilder(64);
    StringBuilder assocTypeQNameBuffer = new StringBuilder(64);
    if (nodeMetaData.getParentAssocs() != null) {
        for (ChildAssociationRef childAssocRef : nodeMetaData.getParentAssocs()) {
            if (qNameBuffer.length() > 0) {
                qNameBuffer.append(";/");
                assocTypeQNameBuffer.append(";/");
            }
            qNameBuffer.append(ISO9075.getXPathName(childAssocRef.getQName()));
            assocTypeQNameBuffer.append(ISO9075.getXPathName(childAssocRef.getTypeQName()));
            doc.addField(FIELD_PARENT, childAssocRef.getParentRef().toString());
            if (childAssocRef.isPrimary()) {
                if (doc.getField(FIELD_PRIMARYPARENT) == null) {
                    doc.addField(FIELD_PRIMARYPARENT, childAssocRef.getParentRef().toString());
                    doc.addField(FIELD_PRIMARYASSOCTYPEQNAME, ISO9075.getXPathName(childAssocRef.getTypeQName()));
                    doc.addField(FIELD_PRIMARYASSOCQNAME, ISO9075.getXPathName(childAssocRef.getQName()));
                } else {
                    log.warn("Duplicate primary parent for node id " + nodeMetaData.getId());
                }
            }
        }
        doc.addField(FIELD_ASSOCTYPEQNAME, assocTypeQNameBuffer.toString());
        doc.addField(FIELD_QNAME, qNameBuffer.toString());
    }
}
Also used : StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) QName(org.alfresco.service.namespace.QName) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef)

Example 20 with StringPropertyValue

use of org.alfresco.solr.client.StringPropertyValue in project SearchServices by Alfresco.

the class SolrInformationServer method indexNonShardCascade.

private void indexNonShardCascade(NodeMetaData nodeMetaData) throws IOException {
    canUpdate();
    SolrQueryRequest request = null;
    UpdateRequestProcessor processor = null;
    try {
        request = getLocalSolrQueryRequest();
        processor = this.core.getUpdateProcessingChain(null).createProcessor(request, new SolrQueryResponse());
        StringPropertyValue stringPropertyValue = (StringPropertyValue) nodeMetaData.getProperties().get(ContentModel.PROP_CASCADE_TX);
        List<FieldInstance> fieldInstances = AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(ContentModel.PROP_CASCADE_TX).getFields();
        FieldInstance fieldInstance = fieldInstances.get(0);
        AddUpdateCommand cmd = new AddUpdateCommand(request);
        SolrInputDocument input = new SolrInputDocument();
        input.addField(FIELD_SOLR4_ID, AlfrescoSolrDataModel.getNodeDocumentId(nodeMetaData.getTenantDomain(), nodeMetaData.getAclId(), nodeMetaData.getId()));
        input.addField(FIELD_VERSION, 0);
        input.addField(fieldInstance.getField(), stringPropertyValue.toString());
        cmd.solrDoc = input;
        processor.processAdd(cmd);
    } finally {
        if (processor != null) {
            processor.finish();
        }
        if (request != null) {
            request.close();
        }
    }
}
Also used : StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) SolrQueryRequest(org.apache.solr.request.SolrQueryRequest) SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) SolrInputDocument(org.apache.solr.common.SolrInputDocument) UpdateRequestProcessor(org.apache.solr.update.processor.UpdateRequestProcessor) FieldInstance(org.alfresco.solr.AlfrescoSolrDataModel.FieldInstance) AddUpdateCommand(org.apache.solr.update.AddUpdateCommand)

Aggregations

StringPropertyValue (org.alfresco.solr.client.StringPropertyValue)20 QName (org.alfresco.service.namespace.QName)15 PropertyValue (org.alfresco.solr.client.PropertyValue)15 NodeRef (org.alfresco.service.cmr.repository.NodeRef)13 StoreRef (org.alfresco.service.cmr.repository.StoreRef)13 ContentPropertyValue (org.alfresco.solr.client.ContentPropertyValue)13 MLTextPropertyValue (org.alfresco.solr.client.MLTextPropertyValue)13 HashMap (java.util.HashMap)11 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)11 MultiPropertyValue (org.alfresco.solr.client.MultiPropertyValue)10 Date (java.util.Date)5 NodeMetaData (org.alfresco.solr.client.NodeMetaData)5 ArrayList (java.util.ArrayList)4 SolrCore (org.apache.solr.core.SolrCore)4 Locale (java.util.Locale)3 AlfrescoSolrDataModel (org.alfresco.solr.AlfrescoSolrDataModel)3 Node (org.alfresco.solr.client.Node)3 SolrInputDocument (org.apache.solr.common.SolrInputDocument)3 LocalSolrQueryRequest (org.apache.solr.request.LocalSolrQueryRequest)3 BeforeClass (org.junit.BeforeClass)3