Documentation ¶
Index ¶
- Constants
- Variables
- type Document
- type DocumentStoredFieldVisitor
- func (visitor *DocumentStoredFieldVisitor) BinaryField(fi *FieldInfo, value []byte) error
- func (visitor *DocumentStoredFieldVisitor) Document() *Document
- func (visitor *DocumentStoredFieldVisitor) DoubleField(fi *FieldInfo, value float64) error
- func (visitor *DocumentStoredFieldVisitor) FloatField(fi *FieldInfo, value float32) error
- func (visitor *DocumentStoredFieldVisitor) IntField(fi *FieldInfo, value int) error
- func (visitor *DocumentStoredFieldVisitor) LongField(fi *FieldInfo, value int64) error
- func (visitor *DocumentStoredFieldVisitor) NeedsField(fi *FieldInfo) (status StoredFieldVisitorStatus, err error)
- func (visitor *DocumentStoredFieldVisitor) StringField(fi *FieldInfo, value string) error
- type Field
- func (f *Field) BinaryValue() []byte
- func (f *Field) Boost() float32
- func (f *Field) FieldType() model.IndexableFieldType
- func (f *Field) Name() string
- func (f *Field) NumericValue() interface{}
- func (f *Field) ReaderValue() io.RuneReader
- func (f *Field) String() string
- func (f *Field) StringValue() string
- func (f *Field) TokenStream(analyzer analysis.Analyzer, reuse analysis.TokenStream) (ts analysis.TokenStream, err error)
- type FieldType
- func (ft *FieldType) DocValueType() model.DocValuesType
- func (ft *FieldType) IndexOptions() model.IndexOptions
- func (ft *FieldType) Indexed() bool
- func (ft *FieldType) NumericType() NumericType
- func (ft *FieldType) OmitNorms() bool
- func (ft *FieldType) SetIndexed(v bool)
- func (ft *FieldType) SetStoreTermVectorOffsets(v bool)
- func (ft *FieldType) SetStoreTermVectorPayloads(v bool)
- func (ft *FieldType) SetStoreTermVectorPositions(v bool)
- func (ft *FieldType) SetStoreTermVectors(v bool)
- func (ft *FieldType) SetStored(v bool)
- func (ft *FieldType) StoreTermVectorOffsets() bool
- func (ft *FieldType) StoreTermVectorPayloads() bool
- func (ft *FieldType) StoreTermVectorPositions() bool
- func (ft *FieldType) StoreTermVectors() bool
- func (ft *FieldType) Stored() bool
- func (ft *FieldType) String() string
- func (ft *FieldType) Tokenized() bool
- type NumericType
- type Store
- type StoredField
- type StoredFieldVisitorAdapter
- func (va *StoredFieldVisitorAdapter) BinaryField(fi *FieldInfo, value []byte) error
- func (va *StoredFieldVisitorAdapter) DoubleField(fi *FieldInfo, value float64) error
- func (va *StoredFieldVisitorAdapter) FloatField(fi *FieldInfo, value float32) error
- func (va *StoredFieldVisitorAdapter) IntField(fi *FieldInfo, value int) error
- func (va *StoredFieldVisitorAdapter) LongField(fi *FieldInfo, value int64) error
- func (va *StoredFieldVisitorAdapter) StringField(fi *FieldInfo, value string) error
- type StringTokenStream
- type TextField
Constants ¶
const ( FIELD_TYPE_NUMERIC_INT = 1 // 32-bit integer numeric type FIELD_TYPE_NUMERIC_LONG = 2 // 64-bit long numeric type FIELD_TYPE_NUMERIC_FLOAT = 3 // 32-bit float numeric type FIELD_TYPE_NUMERIC_DOUBLE = 4 // 64-bit double numeric type )
const STORE_NO = Store(2)
Do not store the field's value in the index.
const STORE_YES = Store(1)
Store the original field value in the index. This is useful for short texts like a document's title which should be displayed with the results. The value is stored in its original form, i.e. no analyzer is used before it is stored.
Variables ¶
var STORED_FIELD_TYPE = func() *FieldType { ans := newFieldType() ans.stored = true return ans }()
Type for a stored-only field.
var STRING_FIELD_TYPE_NOT_STORED = func() *FieldType { ft := newFieldType() ft.indexed = true ft._omitNorms = true ft._indexOptions = model.INDEX_OPT_DOCS_ONLY ft._tokenized = false ft.frozen = true return ft }()
Indexed, not tokenized, omits norms, indexes DOCS_ONLY, not stored.
var STRING_FIELD_TYPE_STORED = func() *FieldType { ft := newFieldType() ft.indexed = true ft._omitNorms = true ft._indexOptions = model.INDEX_OPT_DOCS_ONLY ft.stored = true ft._tokenized = false ft.frozen = true return ft }()
Indexed, not tokenized, omits norms, indexes DOCS_ONLY, stored
var TEXT_FIELD_TYPE_NOT_STORED = func() *FieldType { ft := newFieldType() ft.indexed = true ft._tokenized = true ft.frozen = true return ft }()
indexed, tokenized, not stored.
var TEXT_FIELD_TYPE_STORED = func() *FieldType { ft := newFieldType() ft.indexed = true ft._tokenized = true ft.stored = true ft.frozen = true return ft }()
indexed, tokenized, stored.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
document/Document.java
- Documents are the unit of indexing and search. *
- A Document is a set of fields. Each field has a name and a textual value.
- A field may be {@link org.apache.lucene.index.IndexableFieldType#stored() stored} with the document, in which
- case it is returned with search hits on the document. Thus each document
- should typically contain one or more stored fields which uniquely identify
- it. *
- <p>Note that fields which are <i>not</i> {@link org.apache.lucene.index.IndexableFieldType#stored() stored} are
- <i>not</i> available in documents retrieved from the index, e.g. with {@link
- ScoreDoc#doc} or {@link IndexReader#document(int)}.
func (*Document) Add ¶
func (doc *Document) Add(field IndexableField)
*
- <p>Adds a field to a document. Several fields may be added with
- the same name. In this case, if the fields are indexed, their text is
- treated as though appended for the purposes of search.</p>
- <p> Note that add like the removeField(s) methods only makes sense
- prior to adding a document to an index. These methods cannot
- be used to change the content of an existing index! In order to achieve this,
- a document has to be deleted from an index and a new changed version of that
- document has to be added.</p>
func (*Document) Get ¶
Returns the string value of the field with the given name if any exist in this document, or null. If multiple fields exist with this name, this method returns the first value added. If only binary fields with this name exist, returns null.
For IntField, LongField, FloatField, and DoubleField, it returns the string value of the number. If you want the actual numeric field instance back, use getField().
type DocumentStoredFieldVisitor ¶
type DocumentStoredFieldVisitor struct { *StoredFieldVisitorAdapter // contains filtered or unexported fields }
document/DocumentStoredFieldVisitor.java
A StoredFieldVisitor that creates a Document containing all stored fields, or only specific requested fields provided to DocumentStoredFieldVisitor.
This is used by IndexReader.Document() to load a document.
func NewDocumentStoredFieldVisitor ¶
func NewDocumentStoredFieldVisitor() *DocumentStoredFieldVisitor
* Load all stored fields.
func (*DocumentStoredFieldVisitor) BinaryField ¶
func (visitor *DocumentStoredFieldVisitor) BinaryField(fi *FieldInfo, value []byte) error
func (*DocumentStoredFieldVisitor) Document ¶
func (visitor *DocumentStoredFieldVisitor) Document() *Document
func (*DocumentStoredFieldVisitor) DoubleField ¶
func (visitor *DocumentStoredFieldVisitor) DoubleField(fi *FieldInfo, value float64) error
func (*DocumentStoredFieldVisitor) FloatField ¶
func (visitor *DocumentStoredFieldVisitor) FloatField(fi *FieldInfo, value float32) error
func (*DocumentStoredFieldVisitor) IntField ¶
func (visitor *DocumentStoredFieldVisitor) IntField(fi *FieldInfo, value int) error
func (*DocumentStoredFieldVisitor) LongField ¶
func (visitor *DocumentStoredFieldVisitor) LongField(fi *FieldInfo, value int64) error
func (*DocumentStoredFieldVisitor) NeedsField ¶
func (visitor *DocumentStoredFieldVisitor) NeedsField(fi *FieldInfo) (status StoredFieldVisitorStatus, err error)
func (*DocumentStoredFieldVisitor) StringField ¶
func (visitor *DocumentStoredFieldVisitor) StringField(fi *FieldInfo, value string) error
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
func NewFieldFromReader ¶
func NewFieldFromReader(name string, reader io.RuneReader, ft *FieldType) *Field
Create field with Reader value.
func NewFieldFromString ¶
Create field with String value
func (*Field) BinaryValue ¶
func (*Field) FieldType ¶
func (f *Field) FieldType() model.IndexableFieldType
func (*Field) NumericValue ¶
func (f *Field) NumericValue() interface{}
func (*Field) ReaderValue ¶
func (f *Field) ReaderValue() io.RuneReader
func (*Field) StringValue ¶
func (*Field) TokenStream ¶
func (f *Field) TokenStream(analyzer analysis.Analyzer, reuse analysis.TokenStream) (ts analysis.TokenStream, err error)
type FieldType ¶
type FieldType struct {
// contains filtered or unexported fields
}
Describes the properties of a field.
func NewFieldTypeFrom ¶
Create a new mutable FieldType with all of the properties from <code>ref</code>
func (*FieldType) DocValueType ¶
func (ft *FieldType) DocValueType() model.DocValuesType
func (*FieldType) IndexOptions ¶
func (ft *FieldType) IndexOptions() model.IndexOptions
func (*FieldType) NumericType ¶
func (ft *FieldType) NumericType() NumericType
func (*FieldType) SetIndexed ¶
func (*FieldType) SetStoreTermVectorOffsets ¶
func (*FieldType) SetStoreTermVectorPayloads ¶
func (*FieldType) SetStoreTermVectorPositions ¶
func (*FieldType) SetStoreTermVectors ¶
func (*FieldType) StoreTermVectorOffsets ¶
func (*FieldType) StoreTermVectorPayloads ¶
func (*FieldType) StoreTermVectorPositions ¶
func (*FieldType) StoreTermVectors ¶
type StoredField ¶
type StoredField struct {
*Field
}
A field whose value is stored so that IndexSearcher.doc() and IndexReader.document() will return the field and its value.
type StoredFieldVisitorAdapter ¶
type StoredFieldVisitorAdapter struct{}
func (*StoredFieldVisitorAdapter) BinaryField ¶
func (va *StoredFieldVisitorAdapter) BinaryField(fi *FieldInfo, value []byte) error
func (*StoredFieldVisitorAdapter) DoubleField ¶
func (va *StoredFieldVisitorAdapter) DoubleField(fi *FieldInfo, value float64) error
func (*StoredFieldVisitorAdapter) FloatField ¶
func (va *StoredFieldVisitorAdapter) FloatField(fi *FieldInfo, value float32) error
func (*StoredFieldVisitorAdapter) IntField ¶
func (va *StoredFieldVisitorAdapter) IntField(fi *FieldInfo, value int) error
func (*StoredFieldVisitorAdapter) LongField ¶
func (va *StoredFieldVisitorAdapter) LongField(fi *FieldInfo, value int64) error
func (*StoredFieldVisitorAdapter) StringField ¶
func (va *StoredFieldVisitorAdapter) StringField(fi *FieldInfo, value string) error
type StringTokenStream ¶
type StringTokenStream struct { *analysis.TokenStreamImpl // contains filtered or unexported fields }
func (*StringTokenStream) IncrementToken ¶
func (ts *StringTokenStream) IncrementToken() (bool, error)
type TextField ¶
type TextField struct {
*Field
}
A field that is indexed and tokenized, without term vectors. For example, this would be used on a 'body' field, that contains the bulk of a document's text.
func NewTextFieldFromReader ¶
func NewTextFieldFromReader(name string, reader io.RuneReader) *TextField
Creates a new un-stored TextField with Reader value