org.apache.lucene.index.IndexableFieldType#indexOptions ( )源码实例Demo

下面列出了org.apache.lucene.index.IndexableFieldType#indexOptions ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lucene-solr   文件: FieldType.java
/**
 * Create a new mutable FieldType with all of the properties from <code>ref</code>
 */
public FieldType(IndexableFieldType ref) {
  this.stored = ref.stored();
  this.tokenized = ref.tokenized();
  this.storeTermVectors = ref.storeTermVectors();
  this.storeTermVectorOffsets = ref.storeTermVectorOffsets();
  this.storeTermVectorPositions = ref.storeTermVectorPositions();
  this.storeTermVectorPayloads = ref.storeTermVectorPayloads();
  this.omitNorms = ref.omitNorms();
  this.indexOptions = ref.indexOptions();
  this.docValuesType = ref.docValuesType();
  this.dimensionCount = ref.pointDimensionCount();
  this.indexDimensionCount = ref.pointIndexDimensionCount();
  this.dimensionNumBytes = ref.pointNumBytes();
  if (ref.getAttributes() != null) {
    this.attributes = new HashMap<>(ref.getAttributes());
  }
  // Do not copy frozen!
}
 
源代码2 项目: lucene-solr   文件: Field.java
/**
 * Create field with Reader value.
 * @param name field name
 * @param reader reader value
 * @param type field type
 * @throws IllegalArgumentException if either the name or type
 *         is null, or if the field's type is stored(), or
 *         if tokenized() is false.
 * @throws NullPointerException if the reader is null
 */
public Field(String name, Reader reader, IndexableFieldType type) {
  if (name == null) {
    throw new IllegalArgumentException("name must not be null");
  }
  if (type == null) {
    throw new IllegalArgumentException("type must not be null");
  }
  if (reader == null) {
    throw new NullPointerException("reader must not be null");
  }
  if (type.stored()) {
    throw new IllegalArgumentException("fields with a Reader value cannot be stored");
  }
  if (type.indexOptions() != IndexOptions.NONE && !type.tokenized()) {
    throw new IllegalArgumentException("non-tokenized fields must use String values");
  }
  
  this.name = name;
  this.fieldsData = reader;
  this.type = type;
}
 
源代码3 项目: lucene-solr   文件: Field.java
/**
 * Create field with TokenStream value.
 * @param name field name
 * @param tokenStream TokenStream value
 * @param type field type
 * @throws IllegalArgumentException if either the name or type
 *         is null, or if the field's type is stored(), or
 *         if tokenized() is false, or if indexed() is false.
 * @throws NullPointerException if the tokenStream is null
 */
public Field(String name, TokenStream tokenStream, IndexableFieldType type) {
  if (name == null) {
    throw new IllegalArgumentException("name must not be null");
  }
  if (tokenStream == null) {
    throw new NullPointerException("tokenStream must not be null");
  }
  if (type.indexOptions() == IndexOptions.NONE || !type.tokenized()) {
    throw new IllegalArgumentException("TokenStream fields must be indexed and tokenized");
  }
  if (type.stored()) {
    throw new IllegalArgumentException("TokenStream fields cannot be stored");
  }
  
  this.name = name;
  this.fieldsData = null;
  this.tokenStream = tokenStream;
  this.type = type;
}
 
源代码4 项目: lucene-solr   文件: Field.java
/**
 * Create field with String value.
 * @param name field name
 * @param value string value
 * @param type field type
 * @throws IllegalArgumentException if either the name, value or type
 *         is null, or if the field's type is neither indexed() nor stored(), 
 *         or if indexed() is false but storeTermVectors() is true.
 */
public Field(String name, CharSequence value, IndexableFieldType type) {
  if (name == null) {
    throw new IllegalArgumentException("name must not be null");
  }
  if (value == null) {
    throw new IllegalArgumentException("value must not be null");
  }
  if (type == null) {
    throw new IllegalArgumentException("type must not be null");
  }
  if (!type.stored() && type.indexOptions() == IndexOptions.NONE) {
    throw new IllegalArgumentException("it doesn't make sense to have a field that "
      + "is neither indexed nor stored");
  }
  this.name = name;
  this.fieldsData = value;
  this.type = type;
}