org.apache.blur.analysis
Class FieldManager

java.lang.Object
  extended by org.apache.blur.analysis.FieldManager
Direct Known Subclasses:
BaseFieldManager

public abstract class FieldManager
extends Object


Constructor Summary
FieldManager()
           
 
Method Summary
abstract  boolean addColumnDefinition(String family, String columnName, String subColumnName, boolean fieldLessIndexed, String fieldType, boolean sortable, Map<String,String> props)
          Adds a column definition.
abstract  Boolean checkSupportForCustomQuery(String field)
          Checks to see if the field will deal with creating it's own query objects.
abstract  Boolean checkSupportForFuzzyQuery(String field)
          Checks if this field supports fuzzy queries.
abstract  Boolean checkSupportForPrefixQuery(String field)
          Checks if this field supports prefix queries.
abstract  Boolean checkSupportForRegexQuery(String field)
          Checks if this field supports regex queries.
abstract  Boolean checkSupportForWildcardQuery(String field)
          Checks if this field supports wildcard queries.
abstract  org.apache.lucene.analysis.Analyzer getAnalyzerForIndex()
          Gets the analyzer used for indexing.
abstract  org.apache.lucene.analysis.Analyzer getAnalyzerForIndex(String fieldName)
          Gets the analyzer for the indexing process.
abstract  org.apache.lucene.analysis.Analyzer getAnalyzerForQuery()
          Gets an Analyzer for quering.
abstract  org.apache.lucene.analysis.Analyzer getAnalyzerForQuery(String fieldName)
          Gets the analyzer for the querying.
abstract  org.apache.lucene.search.Query getCustomQuery(String field, String text)
          Gets a custom query for the given field and text.
abstract  boolean getDefaultMissingFieldLessIndexing()
          Should the field be placed in the field less indexing if the table is is not in strict mode.
abstract  Map<String,String> getDefaultMissingFieldProps()
          The field properties used if the table is is not in strict mode.
abstract  String getDefaultMissingFieldType()
          The field type used if the table is is not in strict mode.
abstract  String getFieldLessFieldName()
          Gets the Lucene field name of the field that is used for queries that do not specify a field.
abstract  Set<String> getFieldNames()
           
abstract  List<org.apache.lucene.document.Field> getFields(String rowId, Record record)
          Gets an Iterable of fields for indexing and storing fields into Lucene.
abstract  FieldTypeDefinition getFieldTypeDefinition(String field)
          Gets the FieldTypeDefinition for the given field.
abstract  org.apache.lucene.search.Query getNewRangeQuery(String field, String part1, String part2, boolean startInclusive, boolean endInclusive)
          Gets a range query, if the method returns null the default term range query is used in the parser.
abstract  org.apache.lucene.search.SortField getSortField(String field, boolean reverse)
           
abstract  org.apache.lucene.search.Query getTermQueryIfNumeric(String field, String text)
          This method should return a query (probably a range query) for numeric fields and null for other fields.
abstract  boolean isFieldLessIndexed(String name)
          Checks to see if the field should also be indexed in the field less field.
abstract  boolean isStrict()
          Does the table have strict field names and types.
abstract  boolean isValidColumnDefinition(String family, String columnName)
          Checks if there is a valid column definition for the given family and column name.
abstract  void loadFromStorage()
           
abstract  void registerType(Class<? extends FieldTypeDefinition> c)
          Register a FieldTypeDefinition into this field manager.
abstract  String resolveField(String field)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldManager

public FieldManager()
Method Detail

getFields

public abstract List<org.apache.lucene.document.Field> getFields(String rowId,
                                                                 Record record)
                                                          throws IOException
Gets an Iterable of fields for indexing and storing fields into Lucene.

Parameters:
record -
Returns:
Throws:
IOException

addColumnDefinition

public abstract boolean addColumnDefinition(String family,
                                            String columnName,
                                            String subColumnName,
                                            boolean fieldLessIndexed,
                                            String fieldType,
                                            boolean sortable,
                                            Map<String,String> props)
                                     throws IOException
Adds a column definition.

Parameters:
family - the family name, required.
columnName - the column name, required.
subColumnName - the sub column name, optional can be null if it's not a sub column.
fieldLessIndexed - indicates whether the field should be added to the default field for the record for fieldless searching.
fieldType - the field type name, required.
sortable - makes this column sortable.
props - the configuration properties for this column and type.
Returns:
Throws:
IOException

getAnalyzerForIndex

public abstract org.apache.lucene.analysis.Analyzer getAnalyzerForIndex(String fieldName)
                                                                 throws IOException
Gets the analyzer for the indexing process.

Parameters:
fieldName - the Lucene field name.
Returns:
Analyzer.
Throws:
IOException

getAnalyzerForQuery

public abstract org.apache.lucene.analysis.Analyzer getAnalyzerForQuery(String fieldName)
                                                                 throws IOException
Gets the analyzer for the querying.

Parameters:
fieldName - the Lucene field name.
Returns:
Analyzer.
Throws:
IOException

isValidColumnDefinition

public abstract boolean isValidColumnDefinition(String family,
                                                String columnName)
                                         throws IOException
Checks if there is a valid column definition for the given family and column name.

Parameters:
family - the family name,
columnName - the column name.
Returns:
boolean
Throws:
IOException

getAnalyzerForQuery

public abstract org.apache.lucene.analysis.Analyzer getAnalyzerForQuery()
Gets an Analyzer for quering.

Returns:
the analyzer

checkSupportForFuzzyQuery

public abstract Boolean checkSupportForFuzzyQuery(String field)
                                           throws IOException
Checks if this field supports fuzzy queries.

Parameters:
field - the field name.
Returns:
Boolean null if unknown.
Throws:
IOException

checkSupportForPrefixQuery

public abstract Boolean checkSupportForPrefixQuery(String field)
                                            throws IOException
Checks if this field supports prefix queries.

Parameters:
field - the field name.
Returns:
Boolean null if unknown.
Throws:
IOException

checkSupportForWildcardQuery

public abstract Boolean checkSupportForWildcardQuery(String field)
                                              throws IOException
Checks if this field supports wildcard queries.

Parameters:
field - the field name.
Returns:
Boolean null if unknown.
Throws:
IOException

checkSupportForRegexQuery

public abstract Boolean checkSupportForRegexQuery(String field)
                                           throws IOException
Checks if this field supports regex queries.

Parameters:
field - the field name.
Returns:
Boolean null if unknown.
Throws:
IOException

checkSupportForCustomQuery

public abstract Boolean checkSupportForCustomQuery(String field)
                                            throws IOException
Checks to see if the field will deal with creating it's own query objects.

Parameters:
field - the field name.
Returns:
Boolean null if unknown.
Throws:
IOException

getNewRangeQuery

public abstract org.apache.lucene.search.Query getNewRangeQuery(String field,
                                                                String part1,
                                                                String part2,
                                                                boolean startInclusive,
                                                                boolean endInclusive)
                                                         throws IOException
Gets a range query, if the method returns null the default term range query is used in the parser. This is used to create numeric range queries.

Parameters:
field - the field name.
part1 - the first part.
part2 - the second part.
startInclusive - if the start is inclusive.
endInclusive - if the end is inclusive.
Returns:
the new range query or null.
Throws:
IOException

getTermQueryIfNumeric

public abstract org.apache.lucene.search.Query getTermQueryIfNumeric(String field,
                                                                     String text)
                                                              throws IOException
This method should return a query (probably a range query) for numeric fields and null for other fields.

Parameters:
field - the field name.
text - the text for the term.
Returns:
the query or null.
Throws:
IOException

getFieldTypeDefinition

public abstract FieldTypeDefinition getFieldTypeDefinition(String field)
                                                    throws IOException
Gets the FieldTypeDefinition for the given field.

Parameters:
field - the field name.
Returns:
the FieldTypeDefinition or null if missing.
Throws:
IOException

isFieldLessIndexed

public abstract boolean isFieldLessIndexed(String name)
                                    throws IOException
Checks to see if the field should also be indexed in the field less field.

Parameters:
name - the field name.
Returns:
boolean
Throws:
IOException

getAnalyzerForIndex

public abstract org.apache.lucene.analysis.Analyzer getAnalyzerForIndex()
Gets the analyzer used for indexing.

Returns:
the Analyzer.

getFieldLessFieldName

public abstract String getFieldLessFieldName()
Gets the Lucene field name of the field that is used for queries that do not specify a field.

Returns:
the field name.

getDefaultMissingFieldProps

public abstract Map<String,String> getDefaultMissingFieldProps()
The field properties used if the table is is not in strict mode.

Returns:
properties.

getDefaultMissingFieldType

public abstract String getDefaultMissingFieldType()
The field type used if the table is is not in strict mode.

Returns:
field type.

getDefaultMissingFieldLessIndexing

public abstract boolean getDefaultMissingFieldLessIndexing()
Should the field be placed in the field less indexing if the table is is not in strict mode.

Returns:
boolean.

isStrict

public abstract boolean isStrict()
Does the table have strict field names and types. If so then if a new Column is attempted to be used for indexing then an error will be raised.

Returns:
boolean

getCustomQuery

public abstract org.apache.lucene.search.Query getCustomQuery(String field,
                                                              String text)
                                                       throws IOException
Gets a custom query for the given field and text.

Parameters:
field - the field name.
text - the text to create the custom query.
Returns:
the query object.
Throws:
IOException

registerType

public abstract void registerType(Class<? extends FieldTypeDefinition> c)
Register a FieldTypeDefinition into this field manager.

Parameters:
c - the class.

getFieldNames

public abstract Set<String> getFieldNames()
                                   throws IOException
Throws:
IOException

resolveField

public abstract String resolveField(String field)

loadFromStorage

public abstract void loadFromStorage()
                              throws IOException
Throws:
IOException

getSortField

public abstract org.apache.lucene.search.SortField getSortField(String field,
                                                                boolean reverse)
                                                         throws IOException
Throws:
IOException


Copyright © 2012-2014 The Apache Software Foundation. All Rights Reserved.