Monday, April 12, 2010

Alfresco Search Customization

As per Alfresco documentation default search uses a Boolean "Implied AND" as like Google, Yahoo or any major search engine works. But the behavior of alfresco is seems to be using Boolean “Implied OR”.
But Customization of such kind of search is made easy by Alfresco when it comes to customize Alfresco Web Client.
Let’s go by example.
We have few resume stored as word document in our repository if we do search on Alfresco repository using keywords (java alfresco) it gives all the documents which has meta data(or Full text search) either as Java or as alfresco. But we are intended to search all those documents which have Java and alfresco both skill sets. It is the situation where alfresco default search is based on “Implied OR”.
We can configure this on Alfresco web-client customization if we are using SearchContext . We need to add the configuration in web-client-config-custom.xml as below

        <!-- set this value to true to enable AND text terms for simple/advanced search by default -->

If you are using Search Service (Search using API) then you can set SearchParameter default operator as “implied AND” as below

SearchParameters sp = new SearchParameters();
ResultSet nodeRefs = searchService.query(sp);

With this kind of customization we are sure that we can use exact search as like Google in our Alfresco repository.

Monday, March 29, 2010

Custom Content Transformer

Alfresco has content transformer for most of mime type we are using day to day. But We wanted to have Custom Content Transformer,to show preview of .xfdl file.

.xfdl is extension for electronic form provided by Lotus Forms. This blog is more of creating a Custom Content Transformer for xfdl mime type.

1.How to register new Content Type i.e. “.xfdl”
Create new file “mimetype-custom-extensions.xml” at level “alfresco/mimetype” parallel level to “alfresco/extension” it should not go under “alfresco/extension” e.g. say mimetype-custom-extensions.xml
In this file we configure alfresco-config for area mimetype-map. Define correct mimetype for your extension here.

2.How to register new Custom Content Transformer
Create new file custom-services-context.xml under “alfresco/extension” folder e.g. custom-services-context.xml

In this file we need to define bean for "mimetypeConfigService" and new bean "transformer.xfdlToText" for Transformer "XFDLContentTransformer".

3. Create Custom Content Transformer “”
This is class where Transformation will take place for you extension mimetype. This class will extends the functionality from "AbstractContentTransformer" . This class uses a "transformText" method to transform it. You have different for you different extension and mimetype.

You can download the code from here ...

Wednesday, January 27, 2010

Alfresco FirstFoundationClient (How to setup and Run)

With this blog you will be able to setup and Run FirstFoundationClient sample of Alfresco.

1. Import FirstFoundationClient Project in eclipse (Assuming you are using eclipse).
2. Specify repository properties with “source/alfresco/extension/”.

# Sample custom content and index data location


# Sample database connection properties

3. Create New file “” under “source/alfresco/extension”.
# Sample Hibernate configuration for changing Database dialect
# For a full list:

# PostgreSQL dialect
hibernate.query.substitutions=true TRUE, false FALSE

4. Create new bean definition “hibernateConfigProperties” in “source/alfresco/extension/custom-repository-context.xml”.

<bean id="hibernateConfigProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">

<!-- Override hibernate dialect -->

5. Run with main method.

1. If you are using PostgreSQL or any other database please provide driver classpath or add additional jar to your project.
2. If your alfresco tomcat server is already Running Please try to change avm.jmxrmi.port from 50500 to 50502 and avm.remote.port from 1313 to 1315 in “/source/alfresco/extension/”.