Archive for February 6th, 2008

Nightly Builds for Compass

Wednesday, February 6th, 2008

After the move to a new site, and thanks to Atlassian Bamboo, Compass now has a much enhanced CI builds as well as nightly builds.

So, if you are looking for the latest and greatest of Compass, head over to Compass Build Server. For example for the trunk version (which is currently the 2.0 M2 upcoming version), head over here, pick one of the builds, for example, this latest one. Then, head over to the Artifacts tab, and you will see the artifacts of the nightly builds including releases, reference documentation, and javadoc.

Embedded Hibernate with Compass

Wednesday, February 6th, 2008

Up until now, the integration of Compass with Hibernate was nice, but not as nice as it should be. With the latest 2.0 M1 release, Compass now supports embedded mode with Hibernate, similar to the integration it has with OpenJPA.

So, how does it work? Very simply. Within the hibernate configuration, simply add a single property pointing to where Compass will store the index:

1
2
3
4
5
6
7
<hibernate-configuration>
    <session-factory>
        <!-- Other hibernate mappings and proeprties -->      
 
        <property name="compass.engine.connection">target/test-index</property>
    </session-factory>
</hibernate-configuration>

This will cause Compass to start within Hibernate, automatically add all the searchable Hibernate mapped classes, and start mirroring Hibernate changes to the search engine.

Now, in order to a Compass instance in order to perform searches, you can simply get it from the Hibernate session factory:

1
Compass compass = HibernateHelper.getCompass(sessionFactory);

That simplifies things, no? :). For full reference documentation, read here.