cancel
Showing results for 
Search instead for 
Did you mean: 

can i change a search engine?

robinson
Champ in-the-making
Champ in-the-making
So could I use another search engine instead of Lucene or add a new search service to Alfresco? If so how do i implement it?
2 REPLIES 2

robinson
Champ in-the-making
Champ in-the-making
the lucene search flow seems:
('–>' stand for call, '<–' for injection)

searchService(bean)–> SearchComponent
SearchComponent <–indexerAndSearcherFactory(bean)

indexerAndSearcherFactory–>StoreRedirectorProxyFactory
StoreRedirectorProxyFactory<–luceneIndexerAndSearcherFactory(bean)

luceneIndexerAndSearcherFactory–>LuceneIndexerAndSearcherFactory

suppose adding another xml search service work together with lucene,  that means I mainly need write another XMLSearcherFactoryclass, some JSFs and some beans(no need for index part, as an xml DB already includes it) . Is that right?

andy
Champ on-the-rise
Champ on-the-rise
Hi

You can configure how stores of a given type, or a particular store is indexed and searched; the two are obviously linked. The actual languages supported are up to you.

If indexing is done for you then you need an Indexer that does nothing (NoActionIndexer) The SeachService needs to take the lucene/XPath/or "whatever you fancy queries" and do those against your xml database and wrap the results. (You would need to include XPATH at least to maintain JCR170 level 1 support)

The indexer to use for a store or store protocol is defined in application-context.xml 


<!–                                                                               –>
    <!– Generic factory for making indexers and searchers for a given protol or store –>
    <!–                                                                               –>
    <bean id="indexerAndSearcherFactory" class="org.alfresco.repo.service.StoreRedirectorProxyFactory">
        <property name="proxyInterface">
            <value>org.alfresco.repo.search.IndexerAndSearcher</value>
        </property>
        <property name="defaultBinding">
            <ref bean="luceneIndexerAndSearcherFactory"></ref>
        </property>
        <property name="redirectedProtocolBindings">
            <map>
                <entry key="workspace">
                    <ref bean="luceneIndexerAndSearcherFactory"></ref>
                </entry>
                <entry key="versionStore">
                    <ref bean="luceneIndexerAndSearcherFactory"></ref>
                </entry>
            </map>
        </property>
    </bean>

You can bind your own implementation of IndexerAndSearcher at this point - the SearchComponent will then switch which searcher to use for the correct store.

The lucene implementation has some special hook points for indexing in the spring transactions (for commit, roll back and etc including uncomitted changes in a transaction to be found in searches). I assume you would not need any of this.

You are almost certianly going to need a NodeService and ContentService for your XML database.

Regards

Andy