public InMemoryLuceneSetupTest() { this.luceneSetup = new RAMLuceneSetup(); }
public MMapLuceneSetupTest() { try { this.luceneSetup = new MMapLuceneSetup( createTempDirectory() ); } catch ( final IOException e ) { throw new RuntimeException( e ); } }
public NIOLuceneSetupTest() { try { this.luceneSetup = new NIOLuceneSetup( createTempDirectory() ); } catch ( final IOException e ) { throw new RuntimeException( e ); } }
final IndexSearcher searcher = luceneSetup.nrtSearcher(); luceneSetup.nrtRelease( searcher );
@Test public void test() throws IOException, ParseException { final BaseLuceneSetup config = getLuceneSetup(); final Document doc = new Document(); final String id = "unique.id.here"; doc.add( new StringField( "id", id, Field.Store.YES ) ); doc.add( new StringField( "type", "kie.Path", Field.Store.YES ) ); doc.add( new TextField( "content", "some value here that i will query for 1900.", Field.Store.YES ) ); config.indexDocument( id, doc ); assertNotNull( config.nrtSearcher().doc( 0 ) ); config.deleteIfExists( id ); try { config.nrtSearcher().doc( 0 ); fail( "can't find doc" ); } catch ( IllegalArgumentException e ) { } config.indexDocument( id, doc ); assertNotNull( config.nrtSearcher().doc( 0 ) ); final IndexSearcher searcher = config.nrtSearcher(); final TopScoreDocCollector collector = TopScoreDocCollector.create( 10, true ); searcher.search( new TermQuery( new Term( "content", "value" ) ), collector ); final ScoreDoc[] hits = collector.topDocs().scoreDocs; assertEquals( 1, hits.length ); final TopScoreDocCollector collector2 = TopScoreDocCollector.create( 10, true ); Query q = new QueryParser( LUCENE_40, "content", config.getAnalyzer() ).parse( "some" ); searcher.search( q, collector2 ); final ScoreDoc[] hits2 = collector2.topDocs().scoreDocs; assertEquals( 1, hits2.length ); }
assertNotNull( getMetaModelStore().getMetaObject( "Path" ).getProperty( "dcore.lastModifiedTime" ) ); final IndexSearcher searcher = getLuceneSetup().nrtSearcher(); getLuceneSetup().nrtRelease( searcher ); final IndexSearcher updatedSearcher = getLuceneSetup().nrtSearcher(); getLuceneSetup().nrtRelease( updatedSearcher ); final IndexSearcher deletedSearcher = getLuceneSetup().nrtSearcher(); getLuceneSetup().nrtRelease( deletedSearcher );
public InMemoryIndexEngineSimpleTest() { this.luceneSetup = new RAMLuceneSetup(); this.metaModelStore = new InMemoryMetaModelStore(); }
public MMapIndexEngineSimpleTest() { try { this.luceneSetup = new MMapLuceneSetup( createTempDirectory() ); this.metaModelStore = new InMemoryMetaModelStore(); } catch ( final IOException e ) { throw new RuntimeException( e ); } }
public NIOIndexEngineSimpleTest() { try { this.luceneSetup = new NIOLuceneSetup( createTempDirectory() ); this.metaModelStore = new InMemoryMetaModelStore(); } catch ( final IOException e ) { throw new RuntimeException( e ); } }
assertTrue( metaModelStore.getMetaObject( Path.class.getName() ).getProperty( "custom" ).getTypes().contains( Long.class ) ); final IndexSearcher searcher = luceneSetup.nrtSearcher(); luceneSetup.nrtRelease( searcher );
public InMemoryMetaModelTest() { this.luceneSetup = new RAMLuceneSetup(); this.metaModelStore = new InMemoryMetaModelStore(); }
assertTrue( metaModelStore.getMetaObject( Path.class.getName() ).getProperty( "custom" ).getTypes().contains( Long.class ) ); final IndexSearcher searcher = luceneSetup.nrtSearcher(); luceneSetup.nrtRelease( searcher );
public static IOService ioService() throws InterruptedException { if ( ioService == null ) { metaModelStore = new InMemoryMetaModelStore(); luceneSetup = new RAMLuceneSetup(); indexEngine = new LuceneIndexEngine( metaModelStore, luceneSetup, new SimpleFieldFactory() ); ioService = new IOServiceIndexedImpl( indexEngine, DublinCoreView.class, VersionAttributeView.class ); Thread.sleep( 50 ); } return ioService; }
public IOService ioService() { if ( ioService == null ) { metaModelStore = new InMemoryMetaModelStore(); luceneSetup = new RAMLuceneSetup(); ioService = new IOServiceIndexedImpl( new LuceneIndexEngine( metaModelStore, luceneSetup, new SimpleFieldFactory() ), DublinCoreView.class, VersionAttributeView.class ); } return ioService; }
public IOService ioService() { if ( ioService == null ) { metaModelStore = new InMemoryMetaModelStore(); luceneSetup = new RAMLuceneSetup(); ioService = new IOServiceIndexedImpl( new LuceneIndexEngine( metaModelStore, luceneSetup, new SimpleFieldFactory() ), DublinCoreView.class, VersionAttributeView.class ); } return ioService; }
final FieldFactory factory = new SimpleFieldFactory(); final MetaModelStore store = new InMemoryMetaModelStore(); final LuceneSetup setup = new RAMLuceneSetup(); final MetaIndexEngine engine = new LuceneIndexEngine( store, setup, factory );