edu.mayo.informatics.indexer.api.generators
Class FilterGenerator

java.lang.Object
  extended by edu.mayo.informatics.indexer.api.generators.FilterGenerator

public class FilterGenerator
extends java.lang.Object

This class will create a filter for you that will do post-search filtering.

Author:
Dan Armbrust

Constructor Summary
FilterGenerator()
          Create a new empty filter generator.
 
Method Summary
 void addAllowNumAboveFilter(java.lang.String field, java.util.Date after)
          Restrict results to documents where field is >= after
 void addAllowNumAboveFilter(java.lang.String field, int after, int padToDigits)
          Restrict results to documents where field is >= after
 void addAllowNumAboveFilter(java.lang.String field, java.lang.String after, int padToLength)
          Restrict results to documents where field is >= after
 void addAllowNumBelowFilter(java.lang.String field, java.util.Date before)
          Restrict results to documents where field is <= before
 void addAllowNumBelowFilter(java.lang.String field, int before, int padToDigits)
          Restrict results to documents where field is <= before
 void addAllowNumBelowFilter(java.lang.String field, java.lang.String before, int padToLength)
          Restrict results to documents where field is <= before
 void addNumFilter(java.lang.String field, java.util.Date from, java.util.Date to)
          Restrict results to documents where field is >= from and <= after
 void addNumFilter(java.lang.String field, int from, int to, int padToDigits)
          Restrict results to documents where field is >= from and <= after
 void addNumFilter(java.lang.String field, java.lang.String from, java.lang.String to, int padToLength)
          Restrict results to documents where field is >= from and <= after
 void clearFilters()
          Remove all current filters.
 org.apache.lucene.search.Filter returnFilter()
          Return the filter that has been created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterGenerator

public FilterGenerator()
Create a new empty filter generator. Will return null if returnFilter() is called.

Method Detail

clearFilters

public void clearFilters()
Remove all current filters.


addNumFilter

public void addNumFilter(java.lang.String field,
                         java.lang.String from,
                         java.lang.String to,
                         int padToLength)
Restrict results to documents where field is >= from and <= after

Parameters:
field -
from -
to -
padToLength - All numbers in the index must have the same amount of digits for the filters to work. The value you gave for 'from' and 'to' will have digits added to it so that its lengths matches the padToLength field.

addNumFilter

public void addNumFilter(java.lang.String field,
                         int from,
                         int to,
                         int padToDigits)
Restrict results to documents where field is >= from and <= after

Parameters:
field -
from -
to -
padToDigits - All numbers in the index must have the same amount of digits for the filters to work. The value you gave for 'from' and 'to' will have digits added to it so that its lengths matches the padToDigits field.

addNumFilter

public void addNumFilter(java.lang.String field,
                         java.util.Date from,
                         java.util.Date to)
Restrict results to documents where field is >= from and <= after

Parameters:
field -
from -
to -

addAllowNumBelowFilter

public void addAllowNumBelowFilter(java.lang.String field,
                                   java.lang.String before,
                                   int padToLength)
Restrict results to documents where field is <= before

Parameters:
field -
before -
padToLength - All numbers in the index must have the same amount of digits for the filters to work. The value you gave for 'before' will have digits added to it so that its lengths matches the padToDigits field.

addAllowNumBelowFilter

public void addAllowNumBelowFilter(java.lang.String field,
                                   int before,
                                   int padToDigits)
Restrict results to documents where field is <= before

Parameters:
field -
before -
padToDigits - All numbers in the index must have the same amount of digits for the filters to work. The value you gave for 'before' will have digits added to it so that its lengths matches the padToDigits field.

addAllowNumBelowFilter

public void addAllowNumBelowFilter(java.lang.String field,
                                   java.util.Date before)
Restrict results to documents where field is <= before

Parameters:
field -
before -

addAllowNumAboveFilter

public void addAllowNumAboveFilter(java.lang.String field,
                                   java.lang.String after,
                                   int padToLength)
Restrict results to documents where field is >= after

Parameters:
field -
after -
padToLength - All numbers in the index must have the same amount of digits for the filters to work. The value you gave for 'after' will have digits added to it so that its lengths matches the padToLength field.

addAllowNumAboveFilter

public void addAllowNumAboveFilter(java.lang.String field,
                                   int after,
                                   int padToDigits)
Restrict results to documents where field is >= after

Parameters:
field -
after -
padToDigits - All numbers in the index must have the same amount of digits for the filters to work. The value you gave for 'after' will have digits added to it so that its lengths matches the padToDigits field.

addAllowNumAboveFilter

public void addAllowNumAboveFilter(java.lang.String field,
                                   java.util.Date after)
Restrict results to documents where field is >= after

Parameters:
field -
after -

returnFilter

public org.apache.lucene.search.Filter returnFilter()
Return the filter that has been created.

Returns:
A filter ready to pass to the search interface.

Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.