类org.apache.lucene.index.IndexableFieldType源码实例Demo

下面列出了怎么用org.apache.lucene.index.IndexableFieldType的API类实例代码及写法,或者点击链接到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;
}
 
源代码5 项目: lucene-solr   文件: Field.java
/**
 * Expert: creates a field with no initial value.
 * Intended only for custom Field subclasses.
 * @param name field name
 * @param type field type
 * @throws IllegalArgumentException if either the name or type
 *         is null.
 */
protected Field(String name, IndexableFieldType type) {
  if (name == null) {
    throw new IllegalArgumentException("name must not be null");
  }
  this.name = name;
  if (type == null) {
    throw new IllegalArgumentException("type must not be null");
  }
  this.type = type;
}
 
源代码6 项目: lucene-solr   文件: Field.java
/**
 * Create field with binary value.
 *
 * <p>NOTE: the provided BytesRef is not copied so be sure
 * not to change it until you're done with this field.
 * @param name field name
 * @param bytes BytesRef pointing to binary content (not copied)
 * @param type field type
 * @throws IllegalArgumentException if the field name, bytes or type
 *         is null, or the field's type is indexed().
 */
public Field(String name, BytesRef bytes, IndexableFieldType type) {
  if (name == null) {
    throw new IllegalArgumentException("name must not be null");
  }
  if (bytes == null) {
    throw new IllegalArgumentException("bytes must not be null");
  }
  if (type == null) {
    throw new IllegalArgumentException("type must not be null");
  }
  this.name = name;
  this.fieldsData = bytes;
  this.type = type;
}
 
源代码7 项目: lucene-solr   文件: BinaryPoint.java
/** Expert API */
public BinaryPoint(String name, byte[] packedPoint, IndexableFieldType type) {
  super(name, packedPoint, type);
  if (packedPoint.length != type.pointDimensionCount() * type.pointNumBytes()) {
    throw new IllegalArgumentException("packedPoint is length=" + packedPoint.length + " but type.pointDimensionCount()=" + type.pointDimensionCount() + " and type.pointNumBytes()=" + type.pointNumBytes());
  }
}
 
源代码8 项目: lucene-solr   文件: RankField.java
@Override
protected IndexableField createField(String name, String val, IndexableFieldType type) {
  if (val == null || val.isEmpty()) {
    return null;
  }
  float featureValue;
  try {
    featureValue = Float.parseFloat(val);
  } catch (NumberFormatException nfe) {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Error while creating field '" + name + "' from value '" + val + "'. Expecting float.", nfe);
  }
  // Internally, we always use the same field
  return new FeatureField(INTERNAL_RANK_FIELD_NAME, name, featureValue);
}
 
源代码9 项目: Elasticsearch   文件: NumberFieldMapper.java
@Override
public IndexableFieldType fieldType() {
    return TYPE;
}
 
源代码10 项目: lucene-solr   文件: NewField.java
public IndexableFieldType getFieldType() {
  return fieldType;
}
 
源代码11 项目: lucene-solr   文件: IndexOptionsDialogFactory.java
public void setNewField(NewField nf) {
  this.nf = nf;

  storedCB.setSelected(nf.isStored());

  IndexableFieldType fieldType = nf.getFieldType();
  tokenizedCB.setSelected(fieldType.tokenized());
  omitNormsCB.setSelected(fieldType.omitNorms());
  idxOptCombo.setSelectedItem(fieldType.indexOptions().name());
  storeTVCB.setSelected(fieldType.storeTermVectors());
  storeTVPosCB.setSelected(fieldType.storeTermVectorPositions());
  storeTVOffCB.setSelected(fieldType.storeTermVectorOffsets());
  storeTVPayCB.setSelected(fieldType.storeTermVectorPayloads());
  dvTypeCombo.setSelectedItem(fieldType.docValuesType().name());
  dimCountTF.setText(String.valueOf(fieldType.pointDimensionCount()));
  dimNumBytesTF.setText(String.valueOf(fieldType.pointNumBytes()));

  if (nf.getType().equals(org.apache.lucene.document.TextField.class) ||
      nf.getType().equals(StringField.class) ||
      nf.getType().equals(Field.class)) {
    storedCB.setEnabled(true);
  } else {
    storedCB.setEnabled(false);
  }

  if (nf.getType().equals(Field.class)) {
    tokenizedCB.setEnabled(true);
    omitNormsCB.setEnabled(true);
    idxOptCombo.setEnabled(true);
    storeTVCB.setEnabled(true);
    storeTVPosCB.setEnabled(true);
    storeTVOffCB.setEnabled(true);
    storeTVPosCB.setEnabled(true);
  } else {
    tokenizedCB.setEnabled(false);
    omitNormsCB.setEnabled(false);
    idxOptCombo.setEnabled(false);
    storeTVCB.setEnabled(false);
    storeTVPosCB.setEnabled(false);
    storeTVOffCB.setEnabled(false);
    storeTVPayCB.setEnabled(false);
  }

  // TODO
  dvTypeCombo.setEnabled(false);
  dimCountTF.setEnabled(false);
  dimNumBytesTF.setEnabled(false);
}
 
源代码12 项目: lucene-solr   文件: LazyDocument.java
@Override
public IndexableFieldType fieldType() {
  return getRealValue().fieldType();
}
 
源代码13 项目: lucene-solr   文件: StoredFieldsWriter.java
@Override
public IndexableFieldType fieldType() {
  return StoredField.TYPE;
}
 
源代码14 项目: lucene-solr   文件: Field.java
/** Returns the {@link FieldType} for this field. */
@Override
public IndexableFieldType fieldType() {
  return type;
}
 
源代码15 项目: lucene-solr   文件: SolrDocumentFetcher.java
@Override
public IndexableFieldType fieldType() {
  return searcher.getSchema().getField(name());
}
 
源代码16 项目: elasticsearch-minhash   文件: MinHashFieldMapper.java
@Override
public IndexableFieldType fieldType() {
    return TYPE;
}
 
源代码17 项目: BioSolr   文件: MergeAbstractFieldType.java
private ObjectField(String name, Object object, IndexableFieldType type, float boost) {
  this.name = name;
  this.object = object;
  this.type = type;
  this.boost = boost;
}
 
源代码18 项目: BioSolr   文件: MergeAbstractFieldType.java
@Override
public IndexableFieldType fieldType() {
  return type;
}
 
源代码19 项目: crate   文件: CustomDocValuesField.java
@Override
public IndexableFieldType fieldType() {
    return TYPE;
}
 
源代码20 项目: lucene-solr   文件: Field.java
/**
 * Create field with binary value.
 * 
 * <p>NOTE: the provided byte[] is not copied so be sure
 * not to change it until you're done with this field.
 * @param name field name
 * @param value byte array pointing to binary content (not copied)
 * @param type field type
 * @throws IllegalArgumentException if the field name, value or type
 *         is null, or the field's type is indexed().
 */
public Field(String name, byte[] value, IndexableFieldType type) {
  this(name, value, 0, value.length, type);
}
 
源代码21 项目: lucene-solr   文件: Field.java
/**
 * Create field with binary value.
 * 
 * <p>NOTE: the provided byte[] is not copied so be sure
 * not to change it until you're done with this field.
 * @param name field name
 * @param value byte array pointing to binary content (not copied)
 * @param offset starting position of the byte array
 * @param length valid length of the byte array
 * @param type field type
 * @throws IllegalArgumentException if the field name, value or type
 *         is null, or the field's type is indexed().
 */
public Field(String name, byte[] value, int offset, int length, IndexableFieldType type) {
  this(name, value != null ? new BytesRef(value, offset, length) : null, type);
}
 
 类所在包
 类方法
 同包方法