Updated Branches: refs/heads/0.2.0-newtypesystem 015c6811a -> 430c6ac3b refs/heads/master 05bb056a2 -> 430c6ac3b
API commit for the type system. Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/bbf40b78 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/bbf40b78 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/bbf40b78 Branch: refs/heads/master Commit: bbf40b78dca1b4f08b7af42cab9824094fc90d21 Parents: 89a1cc1 Author: Aaron McCurry <[email protected]> Authored: Fri Jun 28 19:50:29 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Fri Jun 28 19:50:29 2013 -0400 ---------------------------------------------------------------------- .../org/apache/blur/analysis/FieldManager.java | 72 +++++++++++++++++ .../blur/analysis/FieldTypeDefinition.java | 84 ++++++++++++++++++++ 2 files changed, 156 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/bbf40b78/blur-query/src/main/java/org/apache/blur/analysis/FieldManager.java ---------------------------------------------------------------------- diff --git a/blur-query/src/main/java/org/apache/blur/analysis/FieldManager.java b/blur-query/src/main/java/org/apache/blur/analysis/FieldManager.java new file mode 100644 index 0000000..9be9f57 --- /dev/null +++ b/blur-query/src/main/java/org/apache/blur/analysis/FieldManager.java @@ -0,0 +1,72 @@ +package org.apache.blur.analysis; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.util.Map; + +import org.apache.blur.thrift.generated.Record; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.document.Field; + +public abstract class FieldManager { + + /** + * Gets an {@link Iterable} of fields for indexing and storing fields into + * Lucene. + * + * @param record + * @return + */ + public abstract Iterable<? extends Field> getFields(Record record); + + /** + * Adds a column definition. + * + * @param family + * the family name, required. + * @param columnName + * the column name, required. + * @param subColumnName + * the sub column name, optional can be null if it's not a sub + * column. + * @param fieldType + * the field type name, required. + * @param props + * the configuration properties for this column and type. + */ + public abstract void addColumnDefinition(String family, String columnName, String subColumnName, String fieldType, + Map<String, String> props); + + /** + * Gets the analyzer for the indexing process. + * + * @param fieldName + * the Lucene field name. + * @return {@link Analyzer}. + */ + public abstract Analyzer getAnalyzerForIndex(String fieldName); + + /** + * Gets the analyzer for the querying. + * + * @param fieldName + * the Lucene field name. + * @return {@link Analyzer}. + */ + public abstract Analyzer getAnalyzerForQuery(String fieldName); + +} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/bbf40b78/blur-query/src/main/java/org/apache/blur/analysis/FieldTypeDefinition.java ---------------------------------------------------------------------- diff --git a/blur-query/src/main/java/org/apache/blur/analysis/FieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/FieldTypeDefinition.java new file mode 100644 index 0000000..cc19cfe --- /dev/null +++ b/blur-query/src/main/java/org/apache/blur/analysis/FieldTypeDefinition.java @@ -0,0 +1,84 @@ +package org.apache.blur.analysis; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.util.Map; + +import org.apache.blur.thrift.generated.Column; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.document.Field; +import org.apache.lucene.document.FieldType; + +public abstract class FieldTypeDefinition { + + /** + * Gets the name of the field type. + * + * @return the name. + */ + public abstract String getName(); + + /** + * Configures the field type. + * + * @param properties + * the properties. + */ + public abstract void configure(Map<String, String> properties); + + /** + * Gets the {@link Field}s for indexing from a single Column. + * + * @param column + * the {@link Column} + * @return the {@link Iterable} of fields. + */ + public abstract Iterable<? extends Field> getFields(Column column); + + /** + * Gets the {@link FieldType} for stored version. This is the normal Column + * for Blur. + * + * @return the {@link FieldType}. + */ + public abstract FieldType getStoredFieldType(); + + /** + * Gets the {@link FieldType} for non-stored version. This is the sub Column + * for Blur. + * + * @return the {@link FieldType}. + */ + public abstract FieldType getNotStoredFieldType(); + + /** + * Gets the {@link Analyzer} for indexing this should be the same for the + * querying unless you have a good reason. + * + * @return the {@link Analyzer}. + */ + public abstract Analyzer getAnalyzerForIndex(); + + /** + * Gets the {@link Analyzer} for querying this should be the same for the + * indexing unless you have a good reason. + * + * @return the {@link Analyzer}. + */ + public abstract Analyzer getAnalyzerForQuery(); + +}
