
- Lucene - Home
- Lucene - Overview
- Lucene - Environment Setup
- Lucene - First Application
- Lucene - Indexing Classes
- Lucene - Searching Classes
- Lucene - Indexing Process
- Lucene - Search Operation
- Lucene - Sorting
Lucene - Indexing Operations
- Lucene - Indexing Operations
- Lucene - Add Document
- Lucene - Update Document
- Lucene - Delete Document
- Lucene - Field Options
Lucene - Query Programming
- Lucene - Query Programming
- Lucene - TermQuery
- Lucene - TermRangeQuery
- Lucene - PrefixQuery
- Lucene - BooleanQuery
- Lucene - PhraseQuery
- Lucene - WildCardQuery
- Lucene - FuzzyQuery
- Lucene - MatchAllDocsQuery
- Lucene - MatchNoDocsQuery
- Lucene - RegexpQuery
Lucene - Analysis
- Lucene - Analysis
- Lucene - WhitespaceAnalyzer
- Lucene - SimpleAnalyzer
- Lucene - StopAnalyzer
- Lucene - StandardAnalyzer
- Lucene - KeywordAnalyzer
- Lucene - CustomAnalyzer
- Lucene - EnglishAnalyzer
- Lucene - FrenchAnalyzer
- Lucene - SpanishAnalyzer
Lucene - Resources
Lucene - Field Class
Field is the lowest unit or the starting point of the indexing process. It represents the key value pair relationship where a key is used to identify the value to be indexed. Say a field used to represent contents of a document will have key as "contents" and the value may contain the part or all of the text or numeric content of the document.
Lucene can index only text or numeric contents only. This class represents the storage location of the indexes and generally it is a list of files. These files are called index files. Index files are normally created once and then used for read operation or can be deleted.
Class declaration
Following is the declaration for org.apache.lucene.document.Field class −
public class Field extends Object implements IndexableField
Class Fields
Following table shows the class constructors for Field −
S.No. | Field & Description |
---|---|
1 |
protected Object fieldsData Field's value |
2 |
protected final String name Field's name |
3 |
protected final IndexableFieldType type Field's type |
Class Constructors
Following table shows the class constructors for Field −
S.No. | Constructor & Description |
---|---|
1 |
Field(String name, byte[] value, int offset, int length, IndexableFieldType type) Create field with binary value. |
2 |
Field(String name, byte[] value, IndexableFieldType type) Create field with binary value. |
3 |
Field(String name, Reader reader, IndexableFieldType type) Create field with Reader value. |
4 |
Field(String name, CharSequence value, IndexableFieldType type) Create field with String value. |
5 |
Field(String name, TokenStream tokenStream, IndexableFieldType type) Create field with TokenStream value. |
6 |
protected Field(String name, IndexableFieldType type) Expert: creates a field with no initial value. |
7 |
Field(String name, BytesRef bytes, IndexableFieldType type) Create field with binary value. |
S.No. | Method & Description |
---|---|
1 |
BytesRef binaryValue() Non-null if this field has a binary value. |
2 |
IndexableFieldType fieldType() Returns the FieldType for this field. |
3 |
CharSequence getCharSequenceValue() Non-null if this field has a string value. |
4 |
InvertableType invertableType() Describes how this field should be inverted. |
5 |
String name() Field name. |
6 |
Number numericValue() Non-null if this field has a numeric value. |
7 |
Reader readerValue() The value of the field as a Reader, or null. |
8 |
void setBytesValue(byte[] value) Expert: change the value of this field. |
9 |
void setBytesValue(BytesRef value) Expert: change the value of this field. |
10 |
void setByteValue(byte value) Expert: change the value of this field. |
11 |
void setDoubleValue(double value) Expert: change the value of this field. |
12 |
void setFloatValue(float value) Expert: change the value of this field. |
13 |
void setIntValue(int value) Expert: change the value of this field. |
14 |
void setLongValue(long value) Expert: change the value of this field. |
15 |
void setReaderValue(Reader value) Expert: change the value of this field. |
16 |
void setShortValue(short value) Expert: change the value of this field. |
17 |
void setStringValue(String value) Expert: change the value of this field. |
18 |
void setTokenStream(TokenStream tokenStream) Expert: sets the token stream to be used for indexing. |
19 |
StoredValue storedValue() Stored value. |
20 |
String stringValue() The value of the field as a String, or null. |
21 |
TokenStream tokenStream(Analyzer analyzer, TokenStream reuse) Creates the TokenStream used for indexing this field. |
22 |
TokenStream tokenStreamValue() The TokenStream for this field to be used when indexing, or null. |
23 |
String toString() Prints a Field for human consumption. |
Methods Inherited
This class inherits methods from the following classes −
- java.lang.Object