Dataset ds = loadData();
                  ^^^^^^^^^^
Not shown.

    …
    Resource res = ResourceFactory.createProperty("http://ao.com/name/";);
    EntityDefinition entDef = new EntityDefinition("uri", "text", res) ;
    Directory dir =  new RAMDirectory();
    Dataset indexDataset = TextDatasetFactory.createLucene(ds, dir, entDef, 
null);


Stefan,

You have to load the data through "indexDataset" - I guess you are loading it into a plain dataset in loadData.

The Lucene index is built as data is added to the dataset, not when the dataset is wrapper later.

    Andy


On 07/04/17 19:40, Dimov, Stefan wrote:
Thanks Rob,

The problem is, for someone like me, who is new in Jena, it’s hard to follow 
the documentation – not enough examples and the explanations are kind of 
ambiguous (again – from my point of view).

I was hoping on comment and snippet, specifically about my example.


S.



On 4/7/17, 2:25 AM, "Rob Vesse" <[email protected]> wrote:

    What these lines are doing is creating a blank index, in particular the 
last line simply associates a pre-existing index with a dataset i.e. It doesn’t 
actually cause indexing to happen, typically you would first build a persistent 
Lucene index using the command line tool

    
http://jena.apache.org/documentation/query/text-query.html#building-a-text-index

     if you want to explicitly built the index from code your best bet is to 
refer to the code for the commandline tool:

    
https://github.com/apache/jena/blob/master/jena-text/src/main/java/jena/textindexer.java

    Rob

    On 07/04/2017 04:07, "Dimov, Stefan" <[email protected]> wrote:

        Resource res = ResourceFactory.createProperty("http://ao.com/name/";);
        EntityDefinition entDef = new EntityDefinition("uri", "text", res) ;
        Directory dir =  new RAMDirectory();
        Dataset indexDataset = TextDatasetFactory.createLucene(ds, dir, entDef, 
null);






Reply via email to