Documentation ¶
Index ¶
- Variables
- func PhraseTokenization(text string) (tokenized []string)
- func TextIndexSet(req *TextIndexSetReq) (err *er.Error)
- func WordTokenization(req *TextIndexSetReq) (indexes map[string]*IndexWord)
- type IndexPhrase
- func (ip *IndexPhrase) FindRecordsIDByTermsPageNumber(offset, limit uint64) (RecordsID [][32]byte, err *er.Error)
- func (ip *IndexPhrase) GetByRecordID() (err *er.Error)
- func (ip *IndexPhrase) IndexRecordIDForTermsPageNumber()
- func (ip *IndexPhrase) SaveNew() (err *er.Error)
- func (ip *IndexPhrase) Set() (err *er.Error)
- type IndexTextFindReq
- func (req *IndexTextFindReq) JSONDecoder(buf []byte) (err *er.Error)
- func (req *IndexTextFindReq) JSONEncoder() (buf []byte)
- func (req *IndexTextFindReq) JSONLen() (ln int)
- func (req *IndexTextFindReq) SyllabDecoder(buf []byte) (err *er.Error)
- func (req *IndexTextFindReq) SyllabEncoder(buf []byte)
- func (req *IndexTextFindReq) SyllabHeapLen() (ln uint32)
- func (req *IndexTextFindReq) SyllabLen() (ln uint64)
- func (req *IndexTextFindReq) SyllabStackLen() (ln uint32)
- type IndexTextFindRes
- func (res *IndexTextFindRes) JSONDecoder(buf []byte) (err *er.Error)
- func (res *IndexTextFindRes) JSONEncoder() (buf []byte)
- func (res *IndexTextFindRes) JSONLen() (ln int)
- func (res *IndexTextFindRes) SyllabDecoder(buf []byte) (err *er.Error)
- func (res *IndexTextFindRes) SyllabEncoder(buf []byte)
- func (res *IndexTextFindRes) SyllabHeapLen() (ln uint32)
- func (res *IndexTextFindRes) SyllabLen() (ln uint64)
- func (res *IndexTextFindRes) SyllabStackLen() (ln uint32)
- type IndexTextGetReq
- type IndexTextGetRes
- type IndexWord
- func (iw *IndexWord) FindByWordRecordStructure(offset, limit uint64) (phraseTokens []PhraseToken, err *er.Error)
- func (iw *IndexWord) FindRecordsIDByWord(offset, limit uint64) (RecordsID [][32]byte, err *er.Error)
- func (iw *IndexWord) FindRecordsIDByWordRecordOwnerID(offset, limit uint64) (RecordsID [][32]byte, err *er.Error)
- func (iw *IndexWord) FindRecordsIDByWordRecordStructure(offset, limit uint64) (RecordsID [][32]byte, err *er.Error)
- func (iw *IndexWord) FindRecordsIDByWordSecondaryKey(offset, limit uint64) (RecordsID [][32]byte, err *er.Error)
- func (iw *IndexWord) GetByRecordID() (err *er.Error)
- func (iw *IndexWord) GetByWordRecordPrimaryKey() (err *er.Error)
- func (iw *IndexWord) IndexRecordIDForWord()
- func (iw *IndexWord) IndexRecordIDForWordRecordOwnerID()
- func (iw *IndexWord) IndexRecordIDForWordRecordSecondaryKey()
- func (iw *IndexWord) IndexRecordIDForWordRecordStructure()
- func (iw *IndexWord) SaveNew() (err *er.Error)
- func (iw *IndexWord) SaveOrUpdate() (err *er.Error)
- func (iw *IndexWord) Set() (err *er.Error)
- type PhraseToken
- type TextIndexSetReq
- type WordLabel
- type WordSuggestion
- type WordToken
- type WordType
Constants ¶
This section is empty.
Variables ¶
var ( ErrRecordNil = er.New().SetDetail(lang.LanguageEnglish, errorEnglishDomain, "Record Nil", "Given record can't be nil").Save() ErrRecordNotValid = er.New().SetDetail(lang.LanguageEnglish, errorEnglishDomain, "Record Not Valid", "Given recordID exist in storage devices but has diffrent StructureID").Save() ErrRecordNotExist = er.New().SetDetail(lang.LanguageEnglish, errorEnglishDomain, "Record Not Exist", "Given recordID not exist in any storage devices").Save() ErrRecordManipulated = er.New().SetDetail(lang.LanguageEnglish, errorEnglishDomain, "Record Manipulated", "Index record has problem when engine try to read it from storage devices").Save() )
Errors
Functions ¶
func PhraseTokenization ¶
PhraseTokenization uses the delimiters categorized under [Dash, Hyphen, Pattern_Syntax, Quotation_Mark, Terminal_Punctuation, White_Space] drop language-specific stop words (e.g. in English, the, an, a, and, etc.)
func TextIndexSet ¶
func TextIndexSet(req *TextIndexSetReq) (err *er.Error)
TextIndexSet index given text
func WordTokenization ¶
func WordTokenization(req *TextIndexSetReq) (indexes map[string]*IndexWord)
WordTokenization uses the delimiters categorized under [Dash, Hyphen, Pattern_Syntax, Quotation_Mark, Terminal_Punctuation, White_Space] https://github.com/jdkato/prose
Types ¶
type IndexPhrase ¶
type IndexPhrase struct { /* Common header data */ RecordID [32]byte RecordStructureID uint64 RecordSize uint64 WriteTime etime.Time OwnerAppID [32]byte /* Unique data */ Terms []string `index-hash:"RecordID[pair,PageNumber]"` // Array must be order to retrievable! PageNumber uint64 Tokens [10]PhraseToken // Order of PhraseTokens index changed by algorithm in exact period of time! }
IndexPhrase is standard structure to store any hash byte index!! It is simple secondary index e.g. hash("user@email.com")
func (*IndexPhrase) FindRecordsIDByTermsPageNumber ¶
func (ip *IndexPhrase) FindRecordsIDByTermsPageNumber(offset, limit uint64) (RecordsID [][32]byte, err *er.Error)
FindRecordsIDByTermsPageNumber find RecordsID by given Terms+PageNumber
func (*IndexPhrase) GetByRecordID ¶
func (ip *IndexPhrase) GetByRecordID() (err *er.Error)
GetByRecordID method read all existing record data by given RecordID!
func (*IndexPhrase) IndexRecordIDForTermsPageNumber ¶
func (ip *IndexPhrase) IndexRecordIDForTermsPageNumber()
IndexRecordIDForTermsPageNumber save RecordID chain for Terms+PageNumber Call in each update to the exiting record!
func (*IndexPhrase) SaveNew ¶
func (ip *IndexPhrase) SaveNew() (err *er.Error)
SaveNew method set some data and write entire IndexPhrase record with all indexes!
func (*IndexPhrase) Set ¶
func (ip *IndexPhrase) Set() (err *er.Error)
Set method set some data and write entire IndexPhrase record!
type IndexTextFindReq ¶
IndexTextFindReq is request structure of IndexTextFind()
func (*IndexTextFindReq) JSONDecoder ¶
func (req *IndexTextFindReq) JSONDecoder(buf []byte) (err *er.Error)
JSONDecoder decode json to given IndexTextFindReq
func (*IndexTextFindReq) JSONEncoder ¶
func (req *IndexTextFindReq) JSONEncoder() (buf []byte)
JSONEncoder encode given IndexTextFindReq to json format.
func (*IndexTextFindReq) JSONLen ¶
func (req *IndexTextFindReq) JSONLen() (ln int)
JSONLen return json needed len to encode!
func (*IndexTextFindReq) SyllabDecoder ¶
func (req *IndexTextFindReq) SyllabDecoder(buf []byte) (err *er.Error)
SyllabDecoder decode syllab to given IndexTextFindReq
func (*IndexTextFindReq) SyllabEncoder ¶
func (req *IndexTextFindReq) SyllabEncoder(buf []byte)
SyllabEncoder encode given IndexTextFindReq to syllab format
func (*IndexTextFindReq) SyllabHeapLen ¶
func (req *IndexTextFindReq) SyllabHeapLen() (ln uint32)
SyllabHeapLen return heap length of IndexTextFindReq
func (*IndexTextFindReq) SyllabLen ¶
func (req *IndexTextFindReq) SyllabLen() (ln uint64)
SyllabLen return whole length of IndexTextFindReq
func (*IndexTextFindReq) SyllabStackLen ¶
func (req *IndexTextFindReq) SyllabStackLen() (ln uint32)
SyllabStackLen return stack length of IndexTextFindReq
type IndexTextFindRes ¶
type IndexTextFindRes struct {
Tokens [10]PhraseToken
}
IndexTextFindRes is response structure of IndexTextFind()
func IndexTextFind ¶
func IndexTextFind(req *IndexTextFindReq) (res *IndexTextFindRes, err *er.Error)
IndexTextFind return index data of given terms if any exist
func (*IndexTextFindRes) JSONDecoder ¶
func (res *IndexTextFindRes) JSONDecoder(buf []byte) (err *er.Error)
JSONDecoder decode json to given IndexTextFindRes
func (*IndexTextFindRes) JSONEncoder ¶
func (res *IndexTextFindRes) JSONEncoder() (buf []byte)
JSONEncoder encode given IndexTextFindRes to json format.
func (*IndexTextFindRes) JSONLen ¶
func (res *IndexTextFindRes) JSONLen() (ln int)
JSONLen return json needed len to encode!
func (*IndexTextFindRes) SyllabDecoder ¶
func (res *IndexTextFindRes) SyllabDecoder(buf []byte) (err *er.Error)
SyllabDecoder decode syllab to given IndexTextFindRes
func (*IndexTextFindRes) SyllabEncoder ¶
func (res *IndexTextFindRes) SyllabEncoder(buf []byte)
SyllabEncoder encode given IndexTextFindRes to syllab format
func (*IndexTextFindRes) SyllabHeapLen ¶
func (res *IndexTextFindRes) SyllabHeapLen() (ln uint32)
SyllabHeapLen return heap length of IndexTextFindRes
func (*IndexTextFindRes) SyllabLen ¶
func (res *IndexTextFindRes) SyllabLen() (ln uint64)
SyllabLen return whole length of IndexTextFindRes
func (*IndexTextFindRes) SyllabStackLen ¶
func (res *IndexTextFindRes) SyllabStackLen() (ln uint32)
SyllabStackLen return stack length of IndexTextFindRes
type IndexTextGetReq ¶
IndexTextGetReq is request structure of IndexTextGet()
type IndexTextGetRes ¶
type IndexTextGetRes struct {
Tokens [10]PhraseToken
}
IndexTextGetRes is response structure of IndexTextGet()
func IndexTextGet ¶
func IndexTextGet(req *IndexTextGetReq) (res *IndexTextGetRes, err *er.Error)
IndexTextGet return index data of given terms if any exist
type IndexWord ¶
type IndexWord struct { /* Common header data */ RecordID [32]byte RecordStructureID uint64 RecordSize uint64 WriteTime etime.Time OwnerAppID [32]byte /* Unique data */ Word string `index-hash:"RecordID,RecordID[pair,RecordStructure],RecordID[pair,RecordSecondaryKey],RecordID[pair,RecordOwnerID]"` // Order of recordIDs index changed by algorithm in exact period of time! RecordStructure uint64 RecordPrimaryKey [32]byte // Store any primary ID or any data up to 32 byte length e.g. ID RecordSecondaryKey [32]byte // Store any secondary ID or any data up to 32 byte length e.g. GroupID RecordOwnerID [32]byte Tokens []WordToken }
IndexWord is standard structure to store the word index data!
func (*IndexWord) FindByWordRecordStructure ¶
func (iw *IndexWord) FindByWordRecordStructure(offset, limit uint64) (phraseTokens []PhraseToken, err *er.Error)
FindByWordRecordStructure find by given Word+RecordStructure
func (*IndexWord) FindRecordsIDByWord ¶
func (iw *IndexWord) FindRecordsIDByWord(offset, limit uint64) (RecordsID [][32]byte, err *er.Error)
FindRecordsIDByWord find RecordsID by given ID
func (*IndexWord) FindRecordsIDByWordRecordOwnerID ¶
func (iw *IndexWord) FindRecordsIDByWordRecordOwnerID(offset, limit uint64) (RecordsID [][32]byte, err *er.Error)
FindRecordsIDByWordRecordOwnerID find RecordsID by given Word+RecordOwnerID
func (*IndexWord) FindRecordsIDByWordRecordStructure ¶
func (iw *IndexWord) FindRecordsIDByWordRecordStructure(offset, limit uint64) (RecordsID [][32]byte, err *er.Error)
FindRecordsIDByWordRecordStructure find RecordsID by given Word+RecordStructure
func (*IndexWord) FindRecordsIDByWordSecondaryKey ¶
func (iw *IndexWord) FindRecordsIDByWordSecondaryKey(offset, limit uint64) (RecordsID [][32]byte, err *er.Error)
FindRecordsIDByWordSecondaryKey find RecordsID by given Word+SecondaryKey
func (*IndexWord) GetByRecordID ¶
GetByRecordID method read all existing record data by given RecordID!
func (*IndexWord) GetByWordRecordPrimaryKey ¶
GetByWordRecordPrimaryKey find RecordsID by given Word+RecordPrimaryKey
func (*IndexWord) IndexRecordIDForWord ¶
func (iw *IndexWord) IndexRecordIDForWord()
IndexRecordIDForWord save RecordID chain for ID+Language Call in each update to the exiting record!
func (*IndexWord) IndexRecordIDForWordRecordOwnerID ¶
func (iw *IndexWord) IndexRecordIDForWordRecordOwnerID()
IndexRecordIDForWordRecordOwnerID save RecordID chain for Word+RecordOwnerID Don't call in update to an exiting record!
func (*IndexWord) IndexRecordIDForWordRecordSecondaryKey ¶
func (iw *IndexWord) IndexRecordIDForWordRecordSecondaryKey()
IndexRecordIDForWordRecordSecondaryKey save RecordID chain for Word+RecordSecondaryKey Don't call in update to an exiting record!
func (*IndexWord) IndexRecordIDForWordRecordStructure ¶
func (iw *IndexWord) IndexRecordIDForWordRecordStructure()
IndexRecordIDForWordRecordStructure save RecordID chain for Word+RecordStructure Don't call in update to an exiting record!
func (*IndexWord) SaveNew ¶
SaveNew method set some data and write entire IndexWord record with all indexes!
func (*IndexWord) SaveOrUpdate ¶
SaveOrUpdate method set some data and write entire IndexWord record with all indexes or update exiting one!
type PhraseToken ¶
type PhraseToken struct { RecordID [32]byte `json:",string"` RecordStructureID uint64 RecordFieldID uint8 RecordPrimaryKey [32]byte `json:",string"` // Store any primary ID or any data up to 32 byte length }
PhraseToken store detail about a word in the record to index
type TextIndexSetReq ¶
type TextIndexSetReq struct { RecordID [32]byte RecordStructure uint64 RecordPrimaryKey [32]byte // Store any primary ID or any data up to 32 byte length e.g. ID RecordSecondaryKey [32]byte // Store any secondary ID or any data up to 32 byte length e.g. GroupID RecordOwnerID [32]byte RecordFieldID uint8 Text string }
TextIndexSetReq is request structure of TextIndex()
type WordSuggestion ¶
type WordSuggestion struct { /* Common header data */ RecordID [32]byte RecordStructureID uint64 RecordSize uint64 WriteTime etime.Time OwnerAppID [32]byte // contains filtered or unexported fields }
WordSuggestion is standard structure to store any hash byte index!! It is simple secondary index e.g. hash("user@email.com")
type WordToken ¶
type WordToken struct { RecordID [32]byte `json:",string"` RecordFieldID uint8 WordType WordType WordOffsetInSentence uint64 // Position of the word in the sentence WordOffsetInText uint64 // Position of the word in the text OffsetInSentence uint64 // First word charecter possition in the sentence OffsetInText uint64 // First word charecter possition in the text }
WordToken store detail about a word in the record to index
type WordType ¶
type WordType uint16
WordType indicate any word||phrase type
const ( WordTypeUnset WordType = iota WordTypeTag // Mentions something e.g. tag a user > @omid WordTypeHashTag // Mentions some topic e.g. #Victory WordTypeURI // Email addresses > Jane.Doe@example.com || URLs > https://github.com/jdkato/prose WordTypeEmoticon // :-), >:(, o_0, etc. )
Word||phrases types