document

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const STORE_NO = Store(2)

Do not store the field's value in the index.

View Source
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

View Source
var STORED_FIELD_TYPE = func() *FieldType {
	ans := newFieldType()
	ans.stored = true
	return ans
}()

Type for a stored-only field.

View Source
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.

View Source
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

View Source
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.

View Source
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 NewDocument

func NewDocument() *Document

* Constructs a new document with no fields.

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) Fields

func (doc *Document) Fields() []IndexableField

func (*Document) Get

func (doc *Document) Get(name string) string

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

func NewFieldFromString(name, value string, ft *FieldType) *Field

Create field with String value

func (*Field) BinaryValue

func (f *Field) BinaryValue() []byte

func (*Field) Boost

func (f *Field) Boost() float32

func (*Field) FieldType

func (f *Field) FieldType() model.IndexableFieldType

func (*Field) Name

func (f *Field) Name() string

func (*Field) NumericValue

func (f *Field) NumericValue() interface{}

func (*Field) ReaderValue

func (f *Field) ReaderValue() io.RuneReader

func (*Field) String

func (f *Field) String() string

func (*Field) StringValue

func (f *Field) StringValue() string

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

func NewFieldTypeFrom(ref *FieldType) *FieldType

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) Indexed

func (ft *FieldType) Indexed() bool

func (*FieldType) NumericType

func (ft *FieldType) NumericType() NumericType

func (*FieldType) OmitNorms

func (ft *FieldType) OmitNorms() bool

func (*FieldType) SetIndexed

func (ft *FieldType) SetIndexed(v bool)

func (*FieldType) SetStoreTermVectorOffsets

func (ft *FieldType) SetStoreTermVectorOffsets(v bool)

func (*FieldType) SetStoreTermVectorPayloads

func (ft *FieldType) SetStoreTermVectorPayloads(v bool)

func (*FieldType) SetStoreTermVectorPositions

func (ft *FieldType) SetStoreTermVectorPositions(v bool)

func (*FieldType) SetStoreTermVectors

func (ft *FieldType) SetStoreTermVectors(v bool)

func (*FieldType) SetStored

func (ft *FieldType) SetStored(v bool)

func (*FieldType) StoreTermVectorOffsets

func (ft *FieldType) StoreTermVectorOffsets() bool

func (*FieldType) StoreTermVectorPayloads

func (ft *FieldType) StoreTermVectorPayloads() bool

func (*FieldType) StoreTermVectorPositions

func (ft *FieldType) StoreTermVectorPositions() bool

func (*FieldType) StoreTermVectors

func (ft *FieldType) StoreTermVectors() bool

func (*FieldType) Stored

func (ft *FieldType) Stored() bool

func (*FieldType) String

func (ft *FieldType) String() string

Prints a Field for human consumption.

func (*FieldType) Tokenized

func (ft *FieldType) Tokenized() bool

type NumericType

type NumericType int

Data type of the numeric value

type Store

type Store int

Specifies whether and how a field should be stored.

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

func NewTextFieldFromString

func NewTextFieldFromString(name, value string, store Store) *TextField

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL