マニピュレータのManipulatorConfigには、実行するマニピュレータおよびマニピュレータに必要なその他のオプションのプロパティを定義する必須のModuleIdおよびModulePropertyオブジェクトが含まれています。
ias-cmd listModules -t MANIPULATOR Substring Manipulator *Id: com.endeca.ias.extension.sample.manipulator.substring.SubstringManipulator *Type: MANIPULATOR *Description: Generates a new property that is a substring of another property value
マニピュレータは、任意の数のモジュール・プロパティを使用できます。プラグインの開発者は、マニピュレータに必要なモジュール・プロパティおよびそのモジュール・プロパティがオプションに必要であるかどうかを決定できます。
ias-cmd getModuleSpec -id com.endeca.ias.extension.sample.manipulator.substring.SubstringManipulator Substring Manipulator ===================== [Module Information] *Id: com.endeca.ias.extension.sample.manipulator.substring.SubstringManipulator *Type: MANIPULATOR *Description: Generates a new property that is a substring of another property value [Substring Manipulator Configuration Properties] Group: ------- Source Property: *Name: sourceProperty *Type: {http://www.w3.org/2001/XMLSchema}string *Required: true *Default Value: *Max Length: 255 *Description: *Multiple Values: false *Multiple Lines: false *Password: false *Always Show: false Target Property: *Name: targetProperty *Type: {http://www.w3.org/2001/XMLSchema}string *Required: true *Default Value: *Max Length: 255 *Description: *Multiple Values: false *Multiple Lines: false *Password: false *Always Show: false Substring Length: *Name: length *Type: {http://www.w3.org/2001/XMLSchema}integer *Required: true *Default Value: 2147483647 *Min Value: -2147483648 *Max Value: 2147483647 *Description: Substring length *Multiple Values: false *Multiple Lines: false *Password: false *Always Show: false Substring Start Index: *Name: startIndex *Type: {http://www.w3.org/2001/XMLSchema}integer *Required: false *Default Value: 0 *Min Value: -2147483648 *Max Value: 2147483647 *Description: Substring start index (zero based) *Multiple Values: false *Multiple Lines: false *Password: false *Always Show: false
// Connect to the IAS Server. ServiceAddress address = new ServiceAddress("localhost", 8401, contextPath); IasCrawlerLocator locator = IasCrawlerLocator.create(address); IasCrawler crawler = locator.getService(); // Create a new crawl Id with the name set to Demo. CrawlId crawlId = new CrawlId("Demo"); // Create the crawl configuration. CrawlConfig crawlConfig = new CrawlConfig(crawlId); // Create a list for manipulator configurations, even if // there is only one. List<ManipulatorConfig> manipulatorList = new ArrayList<ManipulatorConfig>(); // Create a module ID for a Substring Manipulator. // Set the module ID in the constructor. ModuleId moduleId = new ModuleId("com.endeca.ias.extension.sample.manipulator.substring.SubstringManipulator"); // Create a manipulator configuration. ManipulatorConfig manipulator = new ManipulatorConfig(moduleId); // Create a list for the module property objects. List<ModuleProperty> manipulatorPropsList = new ArrayList<ModuleProperty>(); // Create a module property for sourceProperty. // Set key/values of the module property as strings in the constructor. ModuleProperty sp = new ModuleProperty("sourceProperty", "Endeca.Document.Text"); // Set the module property in the module property list. manipulatorPropsList.add(sp); // Create a module property for targetProperty. // Set key/values of the module property as strings in the constructor. ModuleProperty tp = new ModuleProperty("targetProperty", "Truncated.Text"); // Set the module property in the module property list. manipulatorPropsList.add(tp); // Create a module property for length. // Set key/values of the module property as strings in the constructor. ModuleProperty length = new ModuleProperty("length", "20"); // Set the module property in the module property list. manipulatorPropsList.add(length); // Set the module property list in the manipulator configuration. manipulator.setModuleProperties(manipulatorPropsList); manipulatorList.add(manipulator); // Set the list of manipulator configurations in the crawl configuration. crawlConfig.setManipulatorConfigs(manipulatorList); // Create the crawl. crawler.createCrawl(crawlConfig);