Revision: 2339 http://archive-access.svn.sourceforge.net/archive-access/?rev=2339&view=rev Author: binzino Date: 2008-06-28 16:40:31 -0700 (Sat, 28 Jun 2008) Log Message: ----------- Adde "exclusive" property in which existing values will be removed from the document before any are added by this filter. Modified Paths: -------------- trunk/archive-access/projects/nutchwax/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/ConfigurableIndexingFilter.java Modified: trunk/archive-access/projects/nutchwax/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/ConfigurableIndexingFilter.java =================================================================== --- trunk/archive-access/projects/nutchwax/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/ConfigurableIndexingFilter.java 2008-06-28 23:38:44 UTC (rev 2338) +++ trunk/archive-access/projects/nutchwax/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/ConfigurableIndexingFilter.java 2008-06-28 23:40:31 UTC (rev 2339) @@ -69,22 +69,25 @@ boolean lowerCase = true; boolean store = true; boolean tokenize = false; + boolean exclusive = true; String destKey = srcKey; switch ( spec.length ) { + case 6: + destKey = spec[5]; case 5: - destKey = spec[4]; + exclusive = Boolean.parseBoolean( spec[4] ); case 4: - tokenize = Boolean.parseBoolean( spec[3] ); + tokenize = Boolean.parseBoolean( spec[3] ); case 3: - store = Boolean.parseBoolean( spec[2] ); + store = Boolean.parseBoolean( spec[2] ); case 2: lowerCase = Boolean.parseBoolean( spec[1] ); } - LOG.info( "Add field specification: " + srcKey + ":" + lowerCase + ":" + store + ":" + tokenize + ":" + destKey ); + LOG.info( "Add field specification: " + srcKey + ":" + lowerCase + ":" + store + ":" + tokenize + ":" + exclusive + ":" + destKey ); - this.fieldSpecs.add( new FieldSpecification( srcKey, lowerCase, store, tokenize, destKey ) ); + this.fieldSpecs.add( new FieldSpecification( srcKey, lowerCase, store, tokenize, exclusive, destKey ) ); } } @@ -94,14 +97,16 @@ boolean lowerCase; boolean store; boolean tokenize; + boolean exclusive; String destKey; - public FieldSpecification( String srcKey, boolean lowerCase, boolean store, boolean tokenize, String destKey ) + public FieldSpecification( String srcKey, boolean lowerCase, boolean store, boolean tokenize, boolean exclusive, String destKey ) { this.srcKey = srcKey; this.lowerCase = lowerCase; this.store = store; this.tokenize = tokenize; + this.exclusive = exclusive; this.destKey = destKey; } } @@ -130,6 +135,11 @@ { value = value.toLowerCase( ); } + + if ( spec.exclusive ) + { + doc.removeFields( spec.destKey ); + } doc.add( new Field( spec.destKey, value, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |