use of de.tblsoft.solr.pipeline.bean.FiltersPipeline in project solr-cmd-utils by tblsoft.
the class ForkDocumentFilter method readFiltersFromYamlFile.
protected FiltersPipeline readFiltersFromYamlFile(String fileName) {
try {
InputStream input = new FileInputStream(new File(fileName));
Yaml yaml = new Yaml(new Constructor(FiltersPipeline.class));
FiltersPipeline filters = (FiltersPipeline) yaml.load(input);
input.close();
return filters;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of de.tblsoft.solr.pipeline.bean.FiltersPipeline 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();
}
Aggregations