org.apache.blur.analysis
Class BaseFieldManager

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

public abstract class BaseFieldManager
extends FieldManager


Field Summary
static org.apache.lucene.document.FieldType ID_TYPE
           
 
Constructor Summary
BaseFieldManager(String fieldLessField, org.apache.lucene.analysis.Analyzer defaultAnalyzerForQuerying, boolean strict, String defaultMissingFieldType, boolean defaultMissingFieldLessIndexing, Map<String,String> defaultMissingFieldProps, org.apache.hadoop.conf.Configuration configuration)
           
BaseFieldManager(String fieldLessField, org.apache.lucene.analysis.Analyzer defaultAnalyzerForQuerying, org.apache.hadoop.conf.Configuration configuration)
           
 
Method Summary
 boolean addColumnDefinition(String family, String columnName, String subColumnName, boolean fieldLessIndexed, String fieldType, boolean sortable, Map<String,String> props)
          Adds a column definition.
 void addColumnDefinitionDate(String family, String columnName, String format)
           
 void addColumnDefinitionDouble(String family, String columnName)
           
 void addColumnDefinitionFloat(String family, String columnName)
           
 void addColumnDefinitionGisPointVector(String family, String columnName)
           
 void addColumnDefinitionGisRecursivePrefixTree(String family, String columnName)
           
 void addColumnDefinitionInt(String family, String columnName)
           
 void addColumnDefinitionLong(String family, String columnName)
           
 void addColumnDefinitionString(String family, String columnName)
           
 void addColumnDefinitionText(String family, String columnName)
           
 void addColumnDefinitionTextFieldLess(String family, String columnName)
           
 Boolean checkSupportForCustomQuery(String field)
          Checks to see if the field will deal with creating it's own query objects.
 Boolean checkSupportForFuzzyQuery(String field)
          Checks if this field supports fuzzy queries.
 Boolean checkSupportForPrefixQuery(String field)
          Checks if this field supports prefix queries.
 Boolean checkSupportForRegexQuery(String field)
          Checks if this field supports regex queries.
 Boolean checkSupportForWildcardQuery(String field)
          Checks if this field supports wildcard queries.
 org.apache.lucene.analysis.Analyzer getAnalyzerForIndex()
          Gets the analyzer used for indexing.
 org.apache.lucene.analysis.Analyzer getAnalyzerForIndex(String fieldName)
          Gets the analyzer for the indexing process.
 org.apache.lucene.analysis.Analyzer getAnalyzerForQuery()
          Gets an Analyzer for quering.
 org.apache.lucene.analysis.Analyzer getAnalyzerForQuery(String fieldName)
          Gets the analyzer for the querying.
 org.apache.lucene.search.Query getCustomQuery(String field, String text)
          Gets a custom query for the given field and text.
 boolean getDefaultMissingFieldLessIndexing()
          Should the field be placed in the field less indexing if the table is is not in strict mode.
 Map<String,String> getDefaultMissingFieldProps()
          The field properties used if the table is is not in strict mode.
 String getDefaultMissingFieldType()
          The field type used if the table is is not in strict mode.
 String getFieldLessFieldName()
          Gets the Lucene field name of the field that is used for queries that do not specify a field.
 Set<String> getFieldNames()
           
 List<org.apache.lucene.document.Field> getFields(String rowId, Record record)
          Gets an Iterable of fields for indexing and storing fields into Lucene.
 FieldTypeDefinition getFieldTypeDefinition(String field)
          Gets the FieldTypeDefinition for the given field.
 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.
 org.apache.lucene.search.SortField getSortField(String field, boolean reverse)
           
 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.
 boolean isFieldLessIndexed(String field)
          Checks to see if the field should also be indexed in the field less field.
 boolean isStrict()
          Does the table have strict field names and types.
 boolean isValidColumnDefinition(String family, String columnName)
          Checks if there is a valid column definition for the given family and column name.
 void loadFromStorage()
           
 void registerType(Class<? extends FieldTypeDefinition> c)
          Register a FieldTypeDefinition into this field manager.
 String resolveField(String field)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_TYPE

public static org.apache.lucene.document.FieldType ID_TYPE
Constructor Detail

BaseFieldManager

public BaseFieldManager(String fieldLessField,
                        org.apache.lucene.analysis.Analyzer defaultAnalyzerForQuerying,
                        org.apache.hadoop.conf.Configuration configuration)
                 throws IOException
Throws:
IOException

BaseFieldManager

public BaseFieldManager(String fieldLessField,
                        org.apache.lucene.analysis.Analyzer defaultAnalyzerForQuerying,
                        boolean strict,
                        String defaultMissingFieldType,
                        boolean defaultMissingFieldLessIndexing,
                        Map<String,String> defaultMissingFieldProps,
                        org.apache.hadoop.conf.Configuration configuration)
                 throws IOException
Throws:
IOException
Method Detail

getFieldNames

public Set<String> getFieldNames()
                          throws IOException
Specified by:
getFieldNames in class FieldManager
Throws:
IOException

loadFromStorage

public void loadFromStorage()
                     throws IOException
Specified by:
loadFromStorage in class FieldManager
Throws:
IOException

registerType

public void registerType(Class<? extends FieldTypeDefinition> c)
Description copied from class: FieldManager
Register a FieldTypeDefinition into this field manager.

Specified by:
registerType in class FieldManager
Parameters:
c - the class.

getFields

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

Specified by:
getFields in class FieldManager
Returns:
Throws:
IOException

addColumnDefinition

public boolean addColumnDefinition(String family,
                                   String columnName,
                                   String subColumnName,
                                   boolean fieldLessIndexed,
                                   String fieldType,
                                   boolean sortable,
                                   Map<String,String> props)
                            throws IOException
Description copied from class: FieldManager
Adds a column definition.

Specified by:
addColumnDefinition in class FieldManager
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

isValidColumnDefinition

public boolean isValidColumnDefinition(String family,
                                       String columnName)
                                throws IOException
Description copied from class: FieldManager
Checks if there is a valid column definition for the given family and column name.

Specified by:
isValidColumnDefinition in class FieldManager
Parameters:
family - the family name,
columnName - the column name.
Returns:
boolean
Throws:
IOException

getAnalyzerForIndex

public org.apache.lucene.analysis.Analyzer getAnalyzerForIndex(String fieldName)
                                                        throws IOException
Description copied from class: FieldManager
Gets the analyzer for the indexing process.

Specified by:
getAnalyzerForIndex in class FieldManager
Parameters:
fieldName - the Lucene field name.
Returns:
Analyzer.
Throws:
IOException

getAnalyzerForQuery

public org.apache.lucene.analysis.Analyzer getAnalyzerForQuery(String fieldName)
                                                        throws IOException
Description copied from class: FieldManager
Gets the analyzer for the querying.

Specified by:
getAnalyzerForQuery in class FieldManager
Parameters:
fieldName - the Lucene field name.
Returns:
Analyzer.
Throws:
IOException

addColumnDefinitionGisPointVector

public void addColumnDefinitionGisPointVector(String family,
                                              String columnName)
                                       throws IOException
Throws:
IOException

addColumnDefinitionGisRecursivePrefixTree

public void addColumnDefinitionGisRecursivePrefixTree(String family,
                                                      String columnName)
                                               throws IOException
Throws:
IOException

addColumnDefinitionDate

public void addColumnDefinitionDate(String family,
                                    String columnName,
                                    String format)
                             throws IOException
Throws:
IOException

addColumnDefinitionInt

public void addColumnDefinitionInt(String family,
                                   String columnName)
                            throws IOException
Throws:
IOException

addColumnDefinitionLong

public void addColumnDefinitionLong(String family,
                                    String columnName)
                             throws IOException
Throws:
IOException

addColumnDefinitionFloat

public void addColumnDefinitionFloat(String family,
                                     String columnName)
                              throws IOException
Throws:
IOException

addColumnDefinitionDouble

public void addColumnDefinitionDouble(String family,
                                      String columnName)
                               throws IOException
Throws:
IOException

addColumnDefinitionString

public void addColumnDefinitionString(String family,
                                      String columnName)
                               throws IOException
Throws:
IOException

addColumnDefinitionText

public void addColumnDefinitionText(String family,
                                    String columnName)
                             throws IOException
Throws:
IOException

addColumnDefinitionTextFieldLess

public void addColumnDefinitionTextFieldLess(String family,
                                             String columnName)
                                      throws IOException
Throws:
IOException

getAnalyzerForQuery

public org.apache.lucene.analysis.Analyzer getAnalyzerForQuery()
Description copied from class: FieldManager
Gets an Analyzer for quering.

Specified by:
getAnalyzerForQuery in class FieldManager
Returns:
the analyzer

getAnalyzerForIndex

public org.apache.lucene.analysis.Analyzer getAnalyzerForIndex()
Description copied from class: FieldManager
Gets the analyzer used for indexing.

Specified by:
getAnalyzerForIndex in class FieldManager
Returns:
the Analyzer.

isFieldLessIndexed

public boolean isFieldLessIndexed(String field)
                           throws IOException
Description copied from class: FieldManager
Checks to see if the field should also be indexed in the field less field.

Specified by:
isFieldLessIndexed in class FieldManager
Parameters:
field - the field name.
Returns:
boolean
Throws:
IOException

checkSupportForFuzzyQuery

public Boolean checkSupportForFuzzyQuery(String field)
                                  throws IOException
Description copied from class: FieldManager
Checks if this field supports fuzzy queries.

Specified by:
checkSupportForFuzzyQuery in class FieldManager
Parameters:
field - the field name.
Returns:
Boolean null if unknown.
Throws:
IOException

checkSupportForPrefixQuery

public Boolean checkSupportForPrefixQuery(String field)
                                   throws IOException
Description copied from class: FieldManager
Checks if this field supports prefix queries.

Specified by:
checkSupportForPrefixQuery in class FieldManager
Parameters:
field - the field name.
Returns:
Boolean null if unknown.
Throws:
IOException

checkSupportForWildcardQuery

public Boolean checkSupportForWildcardQuery(String field)
                                     throws IOException
Description copied from class: FieldManager
Checks if this field supports wildcard queries.

Specified by:
checkSupportForWildcardQuery in class FieldManager
Parameters:
field - the field name.
Returns:
Boolean null if unknown.
Throws:
IOException

checkSupportForRegexQuery

public Boolean checkSupportForRegexQuery(String field)
                                  throws IOException
Description copied from class: FieldManager
Checks if this field supports regex queries.

Specified by:
checkSupportForRegexQuery in class FieldManager
Parameters:
field - the field name.
Returns:
Boolean null if unknown.
Throws:
IOException

checkSupportForCustomQuery

public Boolean checkSupportForCustomQuery(String field)
                                   throws IOException
Description copied from class: FieldManager
Checks to see if the field will deal with creating it's own query objects.

Specified by:
checkSupportForCustomQuery in class FieldManager
Parameters:
field - the field name.
Returns:
Boolean null if unknown.
Throws:
IOException

getNewRangeQuery

public org.apache.lucene.search.Query getNewRangeQuery(String field,
                                                       String part1,
                                                       String part2,
                                                       boolean startInclusive,
                                                       boolean endInclusive)
                                                throws IOException
Description copied from class: FieldManager
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.

Specified by:
getNewRangeQuery in class FieldManager
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 org.apache.lucene.search.Query getTermQueryIfNumeric(String field,
                                                            String text)
                                                     throws IOException
Description copied from class: FieldManager
This method should return a query (probably a range query) for numeric fields and null for other fields.

Specified by:
getTermQueryIfNumeric in class FieldManager
Parameters:
field - the field name.
text - the text for the term.
Returns:
the query or null.
Throws:
IOException

getFieldTypeDefinition

public FieldTypeDefinition getFieldTypeDefinition(String field)
                                           throws IOException
Description copied from class: FieldManager
Gets the FieldTypeDefinition for the given field.

Specified by:
getFieldTypeDefinition in class FieldManager
Parameters:
field - the field name.
Returns:
the FieldTypeDefinition or null if missing.
Throws:
IOException

getSortField

public org.apache.lucene.search.SortField getSortField(String field,
                                                       boolean reverse)
                                                throws IOException
Specified by:
getSortField in class FieldManager
Throws:
IOException

getCustomQuery

public org.apache.lucene.search.Query getCustomQuery(String field,
                                                     String text)
                                              throws IOException
Description copied from class: FieldManager
Gets a custom query for the given field and text.

Specified by:
getCustomQuery in class FieldManager
Parameters:
field - the field name.
text - the text to create the custom query.
Returns:
the query object.
Throws:
IOException

getFieldLessFieldName

public String getFieldLessFieldName()
Description copied from class: FieldManager
Gets the Lucene field name of the field that is used for queries that do not specify a field.

Specified by:
getFieldLessFieldName in class FieldManager
Returns:
the field name.

getDefaultMissingFieldProps

public Map<String,String> getDefaultMissingFieldProps()
Description copied from class: FieldManager
The field properties used if the table is is not in strict mode.

Specified by:
getDefaultMissingFieldProps in class FieldManager
Returns:
properties.

getDefaultMissingFieldType

public String getDefaultMissingFieldType()
Description copied from class: FieldManager
The field type used if the table is is not in strict mode.

Specified by:
getDefaultMissingFieldType in class FieldManager
Returns:
field type.

getDefaultMissingFieldLessIndexing

public boolean getDefaultMissingFieldLessIndexing()
Description copied from class: FieldManager
Should the field be placed in the field less indexing if the table is is not in strict mode.

Specified by:
getDefaultMissingFieldLessIndexing in class FieldManager
Returns:
boolean.

isStrict

public boolean isStrict()
Description copied from class: FieldManager
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.

Specified by:
isStrict in class FieldManager
Returns:
boolean

resolveField

public String resolveField(String field)
Specified by:
resolveField in class FieldManager


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