Your current code simply creates a Lucene backed index with your desired 
configuration but it doesn’t actually populate the index.

You have to explicitly populate the index first either with the command line 
tool or by manually building the index from code similar to how the command 
line tool does it:

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

Rob

On 18/10/2017 02:54, "Dimov, Stefan" <[email protected]> wrote:

    Hello,
    
    I have an existing (persisted) TDB and I’m starting Fuseki like this:
    
                Location location = Location.create("tdb");
                ds = TDBFactory.createDataset(location);
                FusekiServer fs = FusekiServer.create()
                        .add("/ds", ds)
                        .build();
                fs.start();
    
    I want to create a (persisted) index from it for specific subject like this:
    
            EntityDefinition entDef = new EntityDefinition("uri", "text", 
"graph") ;
            Resource res = ResourceFactory.createProperty(“http:/ao.com/name”);
            entDef.setPrimaryPredicate(res);
            Path path = Paths.get("lucene_index");
            Directory dir = FSDirectory.open(path);
            ds = TextDatasetFactory.createLucene(ds, dir, entDef, null);
    
    So, the code looks like this:
    
            Location location = Location.create("tdb");
            ds = TDBFactory.createDataset(location);
    
            EntityDefinition entDef = new EntityDefinition("uri", "text", 
"graph") ;
            Resource res = ResourceFactory.createProperty(“http:/ao.com/name”);
            entDef.setPrimaryPredicate(res);
            Path path = Paths.get("lucene_index");
            Directory dir = FSDirectory.open(path);
            ds = TextDatasetFactory.createLucene(ds, dir, entDef, null);
    
            FusekiServer fs = FusekiServer.create()
                        .add("/ds", ds)
                        .build();
             fs.start();
    
    and the dataset is getting loaded, but no index is getting created.
    
    What am I doing wrong?
    
    S.
    
    
    




Reply via email to