Visitin index reopening

55 views
Skip to first unread message

mschipperheyn

unread,
Aug 20, 2011, 7:39:00 PM8/20/11
to bobo-browse
Hi,

I'm revisiting the issue of index reopening again, since I'm using
Hibernate Search as an Indexing mechanism and don't have the benefits
of Zoe taking care of real time indexing I'm using timed reopening.
I'm just wondering with the current Lucene segment reopening still not
implemented in Bobo and Bobo reopening only checking for deletes, what
is the best way to deal with this?

Kind regards,
Marc

Volker

unread,
Aug 25, 2011, 2:28:55 AM8/25/11
to bobo-browse
this is an interesting topic to me, as I have the same configuration.
I am using hibernate search for indexing and for quering, where I do
not need facetting. And I am using bobo browse, where I want to have
the ability to filter the results via facetting.

I, too, would like to know what good or recommended configuration
would be.

kind regards

Elmer van Chastelet

unread,
Sep 14, 2011, 7:54:53 AM9/14/11
to bobo-browse
+1 for me.

I'm using Bobo for faceting on multivalued fields (since Hibernate
Search 3.4.1 uses the field cache of Lucene -> single valued fields
only). In our project, we will have a hybrid solution, where we use
Hibernate Search (HS) faceting for range facets (and probably numeric
facets), because this seems to work better in HS (numeric field
support, not having to deal with String representation etc). Also,
there is only a little documentation about this in the bobo wiki.

So for discrete multivalued fields, we'll use Bobo and we also need to
reopen the BoboIndexReader on a regular basis.
My current idea is to have a singleton BoboIndexReader, which gets
renewed every 2 hours or so (a new BoboIndexReader instance is
created). But I need to test how this scales. Currently, with one
multivalue facet handler, it takes about 2 seconds to have the reader
ready on a 540MB index running from an external hard drive. This will
probably increase when using more facet handlers and bigger source
index.

ps. What index reader do you use as source reader to decorate? I
assume you create an IndexReader instance yourself with the hardcoded
path to the HS index, since the indexReader from the HS SearchFactory
does not support the .directory() invocation done by BoboIndexReader?

mschipperheyn

unread,
Sep 15, 2011, 9:13:01 AM9/15/11
to bobo-browse
Yeah,I have this right now.

Hibernate Search 4.0 allows you to write a custom layer between
Hibernate and Lucene, so it should be able to allow an integration
between Zoie and Hibernate but I haven't had time to really look at
this yet. Documentation on this topic is also very scarce.

What I use now is:

private Map<Class<?>, BoboIndexReader> boboReaders = new
HashMap<Class<?>, BoboIndexReader>();

private static final ReentrantReadWriteLock rwl = new
ReentrantReadWriteLock();
protected static ReentrantReadWriteLock.ReadLock readLock =
rwl.readLock();
protected static ReentrantReadWriteLock.WriteLock writeLock =
rwl.writeLock();

public void refreshBoboIndexReader(Class<?> clazz) {
try {
setBoboIndexReader(clazz, getBoboReader(clazz));
} catch (IOException io) {
log.error("Error creating indexReader", io);
}
}

protected BoboIndexReader getBoboReader(final Class<?> clazz)
throws IOException {
TransactionTemplate transTemplate = new TransactionTemplate(
transactionManager);
DirectoryProvider<FSDirectory>[] dp = transTemplate
.execute(new
TransactionCallback<DirectoryProvider<FSDirectory>[]>() {

@Override
public DirectoryProvider<FSDirectory>[] doInTransaction(
TransactionStatus status) {
FullTextSession fts = Search
.getFullTextSession(getHibernateTemplate()
.getSessionFactory()
.getCurrentSession());
DirectoryProvider<FSDirectory>[] d = fts
.getSearchFactory()
.getDirectoryProviders(clazz);
return d;
}

});
return BoboIndexReader.getInstance(
IndexReader.open(dp[0].getDirectory(), true),
sfFactory.getUnfilteredList(), null);
}

protected void setBoboIndexReader(Class<?> clazz, BoboIndexReader
breader)
throws IOException {
SearchFacetDaoHibernate.writeLock.lock();
try {
if (boboReaders.containsKey(clazz))
boboReaders.get(clazz).close();
boboReaders.put(clazz, breader);
} finally {
SearchFacetDaoHibernate.writeLock.unlock();
}
}

On Sep 14, 8:54 am, Elmer van Chastelet <evanchaste...@gmail.com>
wrote:

Elmer van Chastelet

unread,
Sep 28, 2011, 7:30:03 AM9/28/11
to bobo-browse
Thank you Marc. Our solution is similar, except that I wasn't aware of
the .getDirectory() method of the dirprovider, so I changed that:)

p. funny to see that you're struggling with similar issues. Yesterday
I had the HS datebridge -1 hour/GMT problem, which you posted on their
forums.
Reply all
Reply to author
Forward
0 new messages