Search in sources :

Example 1 with FilterIF

use of de.tblsoft.solr.pipeline.FilterIF in project solr-cmd-utils by tblsoft.

the class AbstractFilterTest method initFilter.

FilterIF initFilter() {
    FilterIF filter = PipelineExecuter.createFilterInstance(filterConfig);
    this.testingFilter = new TestingFilter();
    testingFilter.setNextFilter(new LastFilter());
    filter.setNextFilter(testingFilter);
    filter.init();
    return filter;
}
Also used : TestingFilter(de.tblsoft.solr.pipeline.filter.TestingFilter) FilterIF(de.tblsoft.solr.pipeline.FilterIF) LastFilter(de.tblsoft.solr.pipeline.filter.LastFilter)

Example 2 with FilterIF

use of de.tblsoft.solr.pipeline.FilterIF in project solr-cmd-utils by tblsoft.

the class ForkDocumentFilter method initPipelineFilters.

protected void initPipelineFilters() {
    String includeFilters = getProperty("include", null);
    String absoluteFile = IOUtils.getAbsoluteFile(getBaseDir(), includeFilters);
    FiltersPipeline filtersPipeline = readFiltersFromYamlFile(absoluteFile);
    // init
    FilterIF lastFilter = null;
    FilterIF filterInstance = null;
    try {
        for (int i = 0; i < filtersPipeline.getFilter().size(); i++) {
            Filter filter = filtersPipeline.getFilter().get(i);
            if (filter.getDisabled() != null && filter.getDisabled()) {
                continue;
            }
            filterInstance = PipelineExecuter.createFilterInstance(filter);
            filterInstance.setBaseDir(getBaseDir());
            filterInstance.setVariables(variables);
            if (lastFilter == null) {
                lastFilter = filterInstance;
                continue;
            }
            lastFilter.setNextFilter(filterInstance);
            filterList.add(lastFilter);
            lastFilter = filterInstance;
        }
        filterInstance.setNextFilter(new LastFilter());
        filterList.add(filterInstance);
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
    filterList.get(0).init();
}
Also used : Filter(de.tblsoft.solr.pipeline.bean.Filter) AbstractFilter(de.tblsoft.solr.pipeline.AbstractFilter) FiltersPipeline(de.tblsoft.solr.pipeline.bean.FiltersPipeline) FilterIF(de.tblsoft.solr.pipeline.FilterIF)

Example 3 with FilterIF

use of de.tblsoft.solr.pipeline.FilterIF in project solr-cmd-utils by tblsoft.

the class AbstractFilterTest method document.

protected List<Document> document(Document... document) {
    FilterIF filter = initFilter();
    for (Document d : document) {
        filter.document(d);
    }
    filter.end();
    outputDocumentList = testingFilter.getDocumentList();
    return outputDocumentList;
}
Also used : FilterIF(de.tblsoft.solr.pipeline.FilterIF) Document(de.tblsoft.solr.pipeline.bean.Document)

Aggregations

FilterIF (de.tblsoft.solr.pipeline.FilterIF)3 AbstractFilter (de.tblsoft.solr.pipeline.AbstractFilter)1 Document (de.tblsoft.solr.pipeline.bean.Document)1 Filter (de.tblsoft.solr.pipeline.bean.Filter)1 FiltersPipeline (de.tblsoft.solr.pipeline.bean.FiltersPipeline)1 LastFilter (de.tblsoft.solr.pipeline.filter.LastFilter)1 TestingFilter (de.tblsoft.solr.pipeline.filter.TestingFilter)1