AnsweredAssumed Answered

content store to solr core mapping

Question asked by dbiggins on Jun 10, 2014
Latest reply on Jun 12, 2014 by dbiggins
We are using 4.2 EE on a linux / postgres environment.  I have Solr running on the same physical server as alfresco.

I would like to have one or more content stores have their indexing stored in one of multiple solr cores. 

I can create multiple stores by adding the following 'content-store-selector-context.xml' to my extensions folder:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
        <bean id="firstSharedFileContentStore" class="org.alfresco.repo.content.filestore.FileContentStore">
                <constructor-arg>
                        <value>${dir.root}/storeA</value>
                </constructor-arg>
        </bean>
        <bean id="secondSharedFileContentStore" class="org.alfresco.repo.content.filestore.FileContentStore">
                <constructor-arg>
                        <value>${dir.root}/storeB</value>
                </constructor-arg>
        </bean>
        <bean id="storeSelectorContentStore" parent="storeSelectorContentStoreBase">
                <property name="defaultStoreName">
                        <value>default</value>
                </property>
                <property name="storesByName">
                        <map>
                                <entry key="default">
                                        <ref bean="fileContentStore" />
                                </entry>
                                <entry key="storeA">
                                        <ref bean="firstSharedFileContentStore" />
                                </entry>
                                <entry key="storeB">
                                        <ref bean="secondSharedFileContentStore" />
                                </entry>
                        </map>
                </property>
        </bean>
<!– Point the ContentService to the 'selector' store –>
        <bean id="contentService" parent="baseContentService">
                <property name="store">
                        <ref bean="storeSelectorContentStore" />
                </property>
        </bean>
<!– Add the other stores to the list of stores for cleaning –>
        <bean id="eagerContentStoreCleaner" class="org.alfresco.repo.content.cleanup.EagerContentStoreCleaner" init-method="init">
                <property name="eagerOrphanCleanup" >
                        <value>${system.content.eagerOrphanCleanup}</value>
                </property>
                <property name="stores" >
                        <list>
                                <ref bean="fileContentStore" />
                                <ref bean="firstSharedFileContentStore" />
                                <ref bean="secondSharedFileContentStore" />
                        </list>
                </property>
                <property name="listeners" >
                        <ref bean="deletedContentBackupListeners" />
                </property>
        </bean>
</beans>



That works great: changing the content store physically copies the file on the linux box to the new directory.

I can add multiple cores to the solr instance by executing the solr admin command via http:

https://127.0.0.1:8443/solr/admin/cores?action=newCore&storeRef=storeB://system&property.data.dir.store=storeA
and
https://127.0.0.1:8443/solr/admin/cores?action=newCore&storeRef=storeB://system&property.data.dir.store=storeB


, and then via JMX, adding the new vals for Alfresco -> Configuration -> Search -> managed -> solr -> solr.store.mappings.  This also appears to work: a series of subdirectories are created in the alf_data subdirectory for each new core.

At what point do I tell the content store to use the specific core?  Or probably, the solr subsystem to look at the specific content store?  When I make these changes and restart, it LOOKS like three solr cores each have the same number of records.

Thanks!

Outcomes