Hi,
I have over 20 classes in my app which I want to index. I am testing my application both on Unix and Windows. I am using PostGres DB and c3p0 for connection pooling. There are few problems that I face while indexing.
When I keep maximum allowed connections to 100, Postgres cries "Too many clients". When I reduce it to 25 or so, indexer just hangs at some random place for a long time. ("Too many clients" issue is what I have faced on Windows but I have not tested it on Unix yet. Hanging issue is seen on both)
I have few questions regarding this.
1. Is there any specific formula to know how many connections are proper for the Indexer to run.
2. Is there a proper way to resolve the above issues.
Also I thought as I am facing issues while indexing more classes and it runs fine for a couple of classes, I thought of having a work around and that is to index these classes one by one. So my question regarding to this is, is there any difference between following two pieces of codes? Will there be a difference in the way the indexes are created?
Approach 1:
Code:
Session session = HibUtil.getSessionFactory().openSession();
FullTextSession fullTextSession = Search.getFullTextSession(session);
try {
fullTextSession.createIndexer(Employee.class,Department.class,Adress.class).startAndWait();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Approach 2:
Code:
Session session = HibUtil.getSessionFactory().openSession();
FullTextSession fullTextSession = Search.getFullTextSession(session);
Class[] klass={Employee.class,Department.class,Adress.class};
for(Class k:klass){
try {
fullTextSession.createIndexer(k).startAndWait();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}