Compass – Index and Search Session
2009 February 16
Compass has the concept of a CompassSession, which is created using the Compass instance and then used to perform indexing operation (create/save/delete) and search/read operations. In the upcoming 2.2 M2, two sub types of the CompassSession can now be used. The CompassIndexSession for indexing purposes, and the CompassSearchSesssion for search/read purposes. This can simplify a bit the usage of different sessions (less code complete clutter) , as well as allow for some optimizations to be made when choosing a specific session.
Here is how the indexing session can be used:
1 2 3 4 5 6 7 8 9 | CompassIndexSession session = compass.openIndexSession(); try { session.save(author); session.delete(Author.class, 2); session.create(book); session.commit(); } catch (Exception e) { session.rollback(); } |
And here is how the search session can be used:
1 2 3 4 5 6 7 | CompassSearchSession session = compass.openSearchSession(); try { CompassHits hits = session.find("jack london"); // ... } finally { session.close(); } |
Enjoy!.



My name is Shay Banon, the founder of 
hi,
Can you plz send the Presenation on compass core and integrating it with .net platform, as i need to give some short presentation to my management, but i m running os time.
Hoping for +ve response.
I am not sure how this relates to the post, but if you want to integrate Compass into the .NET platform, your best bet is using REST API on top of Compass that you will develop. Other options include not using Compass and using Lucene.NET or something similar.