Search in sources :

Example 1 with TextIndexLucene

use of org.apache.jena.query.text.TextIndexLucene in project jena by apache.

the class TestTextIndexLuceneAssembler method testResourceDirectory.

@Test
public void testResourceDirectory() {
    TextIndexLuceneAssembler assembler = new TextIndexLuceneAssembler();
    Resource root = SIMPLE_INDEX_SPEC2;
    Assembler a = Assembler.general;
    // the open method is not supposed to throw exceptions when the directory is
    // a resource
    TextIndexLucene index = (TextIndexLucene) assembler.open(a, root, /*mode*/
    null);
    try {
        assertFalse(index.getDirectory() instanceof RAMDirectory);
        assertNotNull(index.getQueryAnalyzer());
    } finally {
        index.close();
    }
}
Also used : Resource(org.apache.jena.rdf.model.Resource) Assembler(org.apache.jena.assembler.Assembler) TextIndexLucene(org.apache.jena.query.text.TextIndexLucene) RAMDirectory(org.apache.lucene.store.RAMDirectory) Test(org.junit.Test)

Example 2 with TextIndexLucene

use of org.apache.jena.query.text.TextIndexLucene in project jena by apache.

the class TestTextIndexLuceneAssembler method testLiteralDirectory.

@Test
public void testLiteralDirectory() {
    TextIndexLuceneAssembler assembler = new TextIndexLuceneAssembler();
    Resource root = SIMPLE_INDEX_SPEC_LITERAL_DIR;
    Assembler a = Assembler.general;
    // the open method is not supposed to throw exceptions when the directory is
    // a literal
    TextIndexLucene index = (TextIndexLucene) assembler.open(a, root, /*mode*/
    null);
    try {
        assertNotNull(index);
    } finally {
        index.close();
    }
}
Also used : Resource(org.apache.jena.rdf.model.Resource) Assembler(org.apache.jena.assembler.Assembler) TextIndexLucene(org.apache.jena.query.text.TextIndexLucene) Test(org.junit.Test)

Example 3 with TextIndexLucene

use of org.apache.jena.query.text.TextIndexLucene in project jena by apache.

the class TestTextIndexLuceneAssembler method testMemDirectory.

@Test
public void testMemDirectory() {
    TextIndexLuceneAssembler assembler = new TextIndexLuceneAssembler();
    Resource root = SIMPLE_INDEX_SPEC_MEM_DIR;
    Assembler a = Assembler.general;
    // the open method is not supposed to throw exceptions when the directory is
    // a iri resource
    TextIndexLucene index = (TextIndexLucene) assembler.open(a, root, /*mode*/
    null);
    try {
        assertTrue(index.getDirectory() instanceof RAMDirectory);
    } finally {
        index.close();
    }
}
Also used : Resource(org.apache.jena.rdf.model.Resource) Assembler(org.apache.jena.assembler.Assembler) TextIndexLucene(org.apache.jena.query.text.TextIndexLucene) RAMDirectory(org.apache.lucene.store.RAMDirectory) Test(org.junit.Test)

Aggregations

Assembler (org.apache.jena.assembler.Assembler)3 TextIndexLucene (org.apache.jena.query.text.TextIndexLucene)3 Resource (org.apache.jena.rdf.model.Resource)3 Test (org.junit.Test)3 RAMDirectory (org.apache.lucene.store.RAMDirectory)2