cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene 'bulking' queries

zomurn
Champ in-the-making
Champ in-the-making
Hi,

I'am coding the data access layer in my alfresco application.
This data access layer contains only method that request the repository via Lucene queries.
I'd like to know (if it is possible and I hope so) how do we bulk queries done with Lucene.

Example : How to query a set of node that satisfy a criteria ? (All user nodes having "M. Dupond" as manager user)
How to code the "in" SQL statement. Instead of doing a "getById" (select something where id = ?), doing a getByIdList (select something where id in (….)). Suppose I retrieve via Lucene a set of Nodes and I want to query with a getByIdList(). All for the purpose to minimize the number of back and forth with database.
Is there more restriction of Lucene compared to SQL ?
3 REPLIES 3

derek
Star Contributor
Star Contributor
In 3.0b, batch fetching (to minimize DB round-trips) is done by
org.alfresco.repo.domain.hibernate.HibernateL1CacheBulkLoader
Regards

zomurn
Champ in-the-making
Champ in-the-making
OK, and how do we code the in statement ?

derek
Star Contributor
Star Contributor
After having executed a Lucene query, and you access a row in the ResultSet, the bulk loader will prefetch nodes from the DB for the next N rows of the results.  There is nothing you need to do to get this - it is built in.

If you want to execute queries directly against the database, you can follow the style of the Hibernate DAO implementations or even the org.alfresco.repo.domain.hibernate.HibernateL1CacheBulkLoader.