Search in sources :

Example 1 with FulltextIndexer

use of org.structr.common.fulltext.FulltextIndexer in project structr by structr.

the class FeedItemContent method updateIndex.

static void updateIndex(final Indexable thisIndexable, final SecurityContext securityContext) {
    try {
        final FulltextIndexer indexer = StructrApp.getInstance(securityContext).getFulltextIndexer();
        indexer.addToFulltextIndex(thisIndexable);
    } catch (FrameworkException fex) {
        logger.warn("Unable to index {}: {}", thisIndexable, fex.getMessage());
    }
}
Also used : FrameworkException(org.structr.common.error.FrameworkException) FulltextIndexer(org.structr.common.fulltext.FulltextIndexer)

Example 2 with FulltextIndexer

use of org.structr.common.fulltext.FulltextIndexer in project structr by structr.

the class File method notifyUploadCompletion.

static void notifyUploadCompletion(final File thisFile) {
    try {
        try (final Tx tx = StructrApp.getInstance().tx()) {
            synchronized (tx) {
                FileHelper.updateMetadata(thisFile, true);
                tx.success();
            }
        }
        final FulltextIndexer indexer = StructrApp.getInstance(thisFile.getSecurityContext()).getFulltextIndexer();
        indexer.addToFulltextIndex(thisFile);
    } catch (FrameworkException fex) {
        logger.warn("Unable to index {}: {}", thisFile, fex.getMessage());
    }
}
Also used : Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) FulltextIndexer(org.structr.common.fulltext.FulltextIndexer)

Example 3 with FulltextIndexer

use of org.structr.common.fulltext.FulltextIndexer in project structr by structr.

the class StructrApp method getFulltextIndexer.

@Override
public FulltextIndexer getFulltextIndexer(final Object... params) {
    final Map<String, StructrModule> modules = StructrApp.getConfiguration().getModules();
    final StructrModule module = modules.get("text-search");
    if (module != null && module instanceof FulltextIndexer) {
        return (FulltextIndexer) module;
    }
    return new DummyFulltextIndexer();
}
Also used : StructrModule(org.structr.module.StructrModule) DummyFulltextIndexer(org.structr.common.fulltext.DummyFulltextIndexer) FulltextIndexer(org.structr.common.fulltext.FulltextIndexer) DummyFulltextIndexer(org.structr.common.fulltext.DummyFulltextIndexer)

Aggregations

FulltextIndexer (org.structr.common.fulltext.FulltextIndexer)3 FrameworkException (org.structr.common.error.FrameworkException)2 DummyFulltextIndexer (org.structr.common.fulltext.DummyFulltextIndexer)1 Tx (org.structr.core.graph.Tx)1 StructrModule (org.structr.module.StructrModule)1