On 10/10/14 17:16, Phillip Rhodes wrote:
On Fri, Oct 10, 2014 at 4:01 AM, Andy Seaborne <[email protected]> wrote:

How do you know it does not work? The code (groovy?) does not read the
index.

Hey Andy, I had written a separate reader program to test using the
index for queries.  I did
it that way to make sure I was seeing results from using the index,
and not accidentally getting
something that was cached in RAM or something.

Anyway, as it turns out, I managed to solve the problem.  As best as I
can tell, the issue
was this, or something close:   The first time(s) I ran this program,
I didn't yet have a
dir.close() line in there to close the Lucene Directory.  As a result,
I was getting
an incomplete Lucene index.  Later, after I fixed that, I kept running
the program
but since I was creating the exact same triples (and not deleting the
TDB dir between
runs) Jena-Text didn't reindex those triples since they already existed.

Perhaps you (or someone) can confirm if this is the way Jena Text would behave
in that regard?

Ideally, jena-text would flush the changes to the index on a commit but at the same time the Directory resource is created outside the jena-text library so the usual pattern is that the creator is responsible for it's lifecycle. For example, you can use try-with-resources on it.

If you create the TextIndex in the app (it's hidden in TextDatasetFactory.createLucene in your code) you can call .startIndexing/.finishIndexing which would also flush changes,

        Andy


Anyway, once I deleted my TDB store and started from scratch,
everything worked exactly
as expected.


Thanks!


Phil


Reply via email to