Files
sdk/model_search_hit.go

459 lines
13 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the SearchHit type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &SearchHit{}
// SearchHit struct for SearchHit
type SearchHit struct {
// Corpus is which store the document lives in: \"kb\" for a document either knowledge leg returned, \"code\" for a span out of one of the org's own repositories, \"files\" for a passage of one of the org's workspace files (ID is then the file's id and Title its citation). It is PROVENANCE — read it to say where a hit came from, not to branch on: the fused ranking is what decides order, and a caller that filters by corpus wants the backend's own endpoint instead.
Corpus *string `json:"corpus,omitempty"`
// DocType is the knowledge doctype: kb.page, kb.memory or kb.source from the semantic leg, and a lexical row's own doctype/type field otherwise. Absent when the row carried neither.
Doctype *string `json:"doctype,omitempty"`
// ID is the document's identity inside its corpus — the KB document name from the semantic leg, or a lexical row's own name/id/_id (falling back to \"row-<n>\" when the row carries none). It is unique with DocType, not alone: the pair is the key the two legs are fused on.
Id *string `json:"id,omitempty"`
// Matched is one entry per leg that returned this document, with that leg's rank and native score. More than one entry means the legs AGREED, which is exactly why the hit outranks one a single leg found. Never empty on a returned hit.
Matched []SearchProvenance `json:"matched,omitempty"`
// Passage is the matching passage, for a hit from the files corpus: the span of the file's section that matched, about 2000 bytes. Absent for every other corpus, whose hits name a document rather than a span of one.
Passage *string `json:"passage,omitempty"`
// Project is the project scope the document was indexed under. Absent for a document saved with none; Request.Project filters the semantic leg on it.
Project *string `json:"project,omitempty"`
// Score is the FUSED score, not a relevance or a similarity: Reciprocal Rank Fusion sums 1/(60+rank) over each leg that returned the document, so it is bounded by roughly 1/61 per leg (about 0.033 for a document two legs put first) and hits are ordered by it, descending. Being built from ranks, it is comparable only WITHIN one response — never across queries, and never against a backend's own score, which stays in Matched.
Score *float64 `json:"score,omitempty"`
// Title is the document's display title — the indexed title from the semantic leg, the row's title (falling back to its name) from the lexical one. Absent when the document has none.
Title *string `json:"title,omitempty"`
// URL is where the document can be opened, carried from the indexed payload — the link back to the app a connector ingested it from. Absent for anything written in the product, which has no external address.
Url *string `json:"url,omitempty"`
AdditionalProperties map[string]interface{}
}
type _SearchHit SearchHit
// NewSearchHit instantiates a new SearchHit object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewSearchHit() *SearchHit {
this := SearchHit{}
return &this
}
// NewSearchHitWithDefaults instantiates a new SearchHit object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewSearchHitWithDefaults() *SearchHit {
this := SearchHit{}
return &this
}
// GetCorpus returns the Corpus field value if set, zero value otherwise.
func (o *SearchHit) GetCorpus() string {
if o == nil || IsNil(o.Corpus) {
var ret string
return ret
}
return *o.Corpus
}
// GetCorpusOk returns a tuple with the Corpus field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchHit) GetCorpusOk() (*string, bool) {
if o == nil || IsNil(o.Corpus) {
return nil, false
}
return o.Corpus, true
}
// HasCorpus returns a boolean if a field has been set.
func (o *SearchHit) HasCorpus() bool {
if o != nil && !IsNil(o.Corpus) {
return true
}
return false
}
// SetCorpus gets a reference to the given string and assigns it to the Corpus field.
func (o *SearchHit) SetCorpus(v string) {
o.Corpus = &v
}
// GetDoctype returns the Doctype field value if set, zero value otherwise.
func (o *SearchHit) GetDoctype() string {
if o == nil || IsNil(o.Doctype) {
var ret string
return ret
}
return *o.Doctype
}
// GetDoctypeOk returns a tuple with the Doctype field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchHit) GetDoctypeOk() (*string, bool) {
if o == nil || IsNil(o.Doctype) {
return nil, false
}
return o.Doctype, true
}
// HasDoctype returns a boolean if a field has been set.
func (o *SearchHit) HasDoctype() bool {
if o != nil && !IsNil(o.Doctype) {
return true
}
return false
}
// SetDoctype gets a reference to the given string and assigns it to the Doctype field.
func (o *SearchHit) SetDoctype(v string) {
o.Doctype = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *SearchHit) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchHit) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *SearchHit) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *SearchHit) SetId(v string) {
o.Id = &v
}
// GetMatched returns the Matched field value if set, zero value otherwise.
func (o *SearchHit) GetMatched() []SearchProvenance {
if o == nil || IsNil(o.Matched) {
var ret []SearchProvenance
return ret
}
return o.Matched
}
// GetMatchedOk returns a tuple with the Matched field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchHit) GetMatchedOk() ([]SearchProvenance, bool) {
if o == nil || IsNil(o.Matched) {
return nil, false
}
return o.Matched, true
}
// HasMatched returns a boolean if a field has been set.
func (o *SearchHit) HasMatched() bool {
if o != nil && !IsNil(o.Matched) {
return true
}
return false
}
// SetMatched gets a reference to the given []SearchProvenance and assigns it to the Matched field.
func (o *SearchHit) SetMatched(v []SearchProvenance) {
o.Matched = v
}
// GetPassage returns the Passage field value if set, zero value otherwise.
func (o *SearchHit) GetPassage() string {
if o == nil || IsNil(o.Passage) {
var ret string
return ret
}
return *o.Passage
}
// GetPassageOk returns a tuple with the Passage field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchHit) GetPassageOk() (*string, bool) {
if o == nil || IsNil(o.Passage) {
return nil, false
}
return o.Passage, true
}
// HasPassage returns a boolean if a field has been set.
func (o *SearchHit) HasPassage() bool {
if o != nil && !IsNil(o.Passage) {
return true
}
return false
}
// SetPassage gets a reference to the given string and assigns it to the Passage field.
func (o *SearchHit) SetPassage(v string) {
o.Passage = &v
}
// GetProject returns the Project field value if set, zero value otherwise.
func (o *SearchHit) GetProject() string {
if o == nil || IsNil(o.Project) {
var ret string
return ret
}
return *o.Project
}
// GetProjectOk returns a tuple with the Project field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchHit) GetProjectOk() (*string, bool) {
if o == nil || IsNil(o.Project) {
return nil, false
}
return o.Project, true
}
// HasProject returns a boolean if a field has been set.
func (o *SearchHit) HasProject() bool {
if o != nil && !IsNil(o.Project) {
return true
}
return false
}
// SetProject gets a reference to the given string and assigns it to the Project field.
func (o *SearchHit) SetProject(v string) {
o.Project = &v
}
// GetScore returns the Score field value if set, zero value otherwise.
func (o *SearchHit) GetScore() float64 {
if o == nil || IsNil(o.Score) {
var ret float64
return ret
}
return *o.Score
}
// GetScoreOk returns a tuple with the Score field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchHit) GetScoreOk() (*float64, bool) {
if o == nil || IsNil(o.Score) {
return nil, false
}
return o.Score, true
}
// HasScore returns a boolean if a field has been set.
func (o *SearchHit) HasScore() bool {
if o != nil && !IsNil(o.Score) {
return true
}
return false
}
// SetScore gets a reference to the given float64 and assigns it to the Score field.
func (o *SearchHit) SetScore(v float64) {
o.Score = &v
}
// GetTitle returns the Title field value if set, zero value otherwise.
func (o *SearchHit) GetTitle() string {
if o == nil || IsNil(o.Title) {
var ret string
return ret
}
return *o.Title
}
// GetTitleOk returns a tuple with the Title field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchHit) GetTitleOk() (*string, bool) {
if o == nil || IsNil(o.Title) {
return nil, false
}
return o.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (o *SearchHit) HasTitle() bool {
if o != nil && !IsNil(o.Title) {
return true
}
return false
}
// SetTitle gets a reference to the given string and assigns it to the Title field.
func (o *SearchHit) SetTitle(v string) {
o.Title = &v
}
// GetUrl returns the Url field value if set, zero value otherwise.
func (o *SearchHit) GetUrl() string {
if o == nil || IsNil(o.Url) {
var ret string
return ret
}
return *o.Url
}
// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchHit) GetUrlOk() (*string, bool) {
if o == nil || IsNil(o.Url) {
return nil, false
}
return o.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (o *SearchHit) HasUrl() bool {
if o != nil && !IsNil(o.Url) {
return true
}
return false
}
// SetUrl gets a reference to the given string and assigns it to the Url field.
func (o *SearchHit) SetUrl(v string) {
o.Url = &v
}
func (o SearchHit) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o SearchHit) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Corpus) {
toSerialize["corpus"] = o.Corpus
}
if !IsNil(o.Doctype) {
toSerialize["doctype"] = o.Doctype
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Matched) {
toSerialize["matched"] = o.Matched
}
if !IsNil(o.Passage) {
toSerialize["passage"] = o.Passage
}
if !IsNil(o.Project) {
toSerialize["project"] = o.Project
}
if !IsNil(o.Score) {
toSerialize["score"] = o.Score
}
if !IsNil(o.Title) {
toSerialize["title"] = o.Title
}
if !IsNil(o.Url) {
toSerialize["url"] = o.Url
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *SearchHit) UnmarshalJSON(data []byte) (err error) {
varSearchHit := _SearchHit{}
err = json.Unmarshal(data, &varSearchHit)
if err != nil {
return err
}
*o = SearchHit(varSearchHit)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "corpus")
delete(additionalProperties, "doctype")
delete(additionalProperties, "id")
delete(additionalProperties, "matched")
delete(additionalProperties, "passage")
delete(additionalProperties, "project")
delete(additionalProperties, "score")
delete(additionalProperties, "title")
delete(additionalProperties, "url")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableSearchHit struct {
value *SearchHit
isSet bool
}
func (v NullableSearchHit) Get() *SearchHit {
return v.value
}
func (v *NullableSearchHit) Set(val *SearchHit) {
v.value = val
v.isSet = true
}
func (v NullableSearchHit) IsSet() bool {
return v.isSet
}
func (v *NullableSearchHit) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableSearchHit(val *SearchHit) *NullableSearchHit {
return &NullableSearchHit{value: val, isSet: true}
}
func (v NullableSearchHit) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableSearchHit) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}