search

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package search interacts with the MarkLogic search API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(c *clients.Client, parameters map[string]string, transaction *util.Transaction, response handle.ResponseHandle) error

Delete documents that match specified collection, directory, etc.

func Search(c *clients.Client, text string, start int64, pageLength int64, transaction *util.Transaction, response handle.ResponseHandle) error

Search with text value

func SerializeXMLWithQueries

func SerializeXMLWithQueries(d *xml.Decoder, start xml.StartElement) ([]interface{}, error)

SerializeXMLWithQueries Serializes text into Query struct

func StructuredSearch

func StructuredSearch(c *clients.Client, query handle.Handle, start int64, pageLength int64, transaction *util.Transaction, response handle.ResponseHandle) error

StructuredSearch searches with a structured query

func StructuredSuggestions

func StructuredSuggestions(c *clients.Client, query handle.Handle, partialQ string, limit int64, options string, response handle.ResponseHandle) error

StructuredSuggestions suggests query text based off of a structured query

Types

type AndNotQuery

type AndNotQuery struct {
	XMLName       xml.Name      `xml:"http://marklogic.com/appservices/search and-not-query" json:"-"`
	PositiveQuery PositiveQuery `xml:"http://marklogic.com/appservices/search positive-query" json:"positive-query,omitempty"`
	NegativeQuery NegativeQuery `xml:"http://marklogic.com/appservices/search negative-query" json:"negative-query,omitempty"`
}

AndNotQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_65108

type AndQuery

type AndQuery struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search and-query" json:"-"`
	Ordered bool          `xml:"http://marklogic.com/appservices/search ordered,omitempty" json:"ordered,omitempty"`
	Queries []interface{} `xml:",any" json:"queries"`
}

AndQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_83674

func (*AndQuery) UnmarshalXML

func (q *AndQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML AndQuery converts to XML

type BoostQuery

type BoostQuery struct {
	XMLName       xml.Name      `xml:"http://marklogic.com/appservices/search boost-query" json:"-"`
	MatchingQuery MatchingQuery `xml:"http://marklogic.com/appservices/search matching-query" json:"matching-query,omitempty"`
	BoostingQuery BoostingQuery `xml:"http://marklogic.com/appservices/search boosting-query" json:"boosting-query,omitempty"`
}

BoostQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_25949

type BoostingQuery

type BoostingQuery struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search boosting-query" json:"-"`
	Queries []interface{} `xml:",any" json:"queries"`
}

BoostingQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_25949

func (*BoostingQuery) UnmarshalXML

func (q *BoostingQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML BoostingQuery converts to XML

type Box

type Box struct {
	XMLName xml.Name `xml:"http://marklogic.com/appservices/search box" json:"-"`
	South   float64  `xml:"http://marklogic.com/appservices/search south" json:"south,omitempty"`
	West    float64  `xml:"http://marklogic.com/appservices/search west" json:"west,omitempty"`
	North   float64  `xml:"http://marklogic.com/appservices/search north" json:"north,omitempty"`
	East    float64  `xml:"http://marklogic.com/appservices/search east" json:"east,omitempty"`
}

Box represents http://docs.marklogic.com/guide/search-dev/structured-query#id_87280

type Circle

type Circle struct {
	XMLName xml.Name `xml:"http://marklogic.com/appservices/search circle" json:"-"`
	Radius  float64  `xml:"http://marklogic.com/appservices/search radius" json:"radius,omitempty"`
	Point   Point    `xml:"http://marklogic.com/appservices/search point" json:"point,omitempty"`
}

Circle represents http://docs.marklogic.com/guide/search-dev/structured-query#id_87280

type CollectionQuery

type CollectionQuery struct {
	XMLName xml.Name `xml:"http://marklogic.com/appservices/search collection-query" json:"-"`
	URIs    []string `xml:"http://marklogic.com/appservices/search uri" json:"uri,omitempty"`
}

CollectionQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_76890

type CombinedQuery

type CombinedQuery struct {
	XMLName         xml.Name `xml:"http://marklogic.com/appservices/search search" json:"search"`
	StructuredQuery Query    `xml:"http://marklogic.com/appservices/search query" json:"query,omitempty"`
	QText           []string `xml:"http://marklogic.com/appservices/search qtext" json:"qtext,omitempty"`
	SPARQL          string   `xml:"http://marklogic.com/appservices/search sparql" json:"sparql,omitempty"`
}

CombinedQuery represents https://docs.marklogic.com/guide/rest-dev/search#id_69918

type ContainerQuery

type ContainerQuery struct {
	XMLName       xml.Name      `xml:"http://marklogic.com/appservices/search container-query" json:"-"`
	Element       QueryElement  `xml:"http://marklogic.com/appservices/search element,omitempty" json:"element,omitempty"`
	JSONKey       string        `xml:"http://marklogic.com/appservices/search json-key,omitempty" json:"json-key,omitempty"`
	FragmentScope string        `xml:"http://marklogic.com/appservices/search fragment-scope,omitempty" json:"fragment-scope,omitempty"`
	Queries       []interface{} `xml:",any" json:"queries"`
}

ContainerQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_87231

func (*ContainerQuery) UnmarshalXML

func (q *ContainerQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML ContainerQuery converts to XML

type DirectoryQuery

type DirectoryQuery struct {
	XMLName  xml.Name `xml:"http://marklogic.com/appservices/search directory-query" json:"-"`
	URIs     []string `xml:"http://marklogic.com/appservices/search uri" json:"uri,omitempty"`
	Infinite bool     `xml:"http://marklogic.com/appservices/search infinite,omitempty" json:"infinite,omitempty"`
}

DirectoryQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_94821

type DocumentFragmentQuery

type DocumentFragmentQuery struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search document-fragment-query" json:"-"`
	Queries []interface{} `xml:",any" json:"queries"`
}

DocumentFragmentQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_30556

func (*DocumentFragmentQuery) UnmarshalXML

func (q *DocumentFragmentQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML DocumentFragmentQuery converts to XML

type DocumentQuery

type DocumentQuery struct {
	XMLName xml.Name `xml:"http://marklogic.com/appservices/search document-query" json:"-"`
	URIs    []string `xml:"http://marklogic.com/appservices/search uri" json:"uri,omitempty"`
}

DocumentQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_27172

type Facet

type Facet struct {
	Name        string       `xml:"name,attr" json:"name,omitempty"`
	Type        string       `xml:"type,attr" json:"type,omitempty"`
	FacetValues []FacetValue `xml:"http://marklogic.com/appservices/search facet-value" json:"facet-value,omitempty"`
}

Facet represents a facet and contains a slice of FacetValue

type FacetValue

type FacetValue struct {
	Name  string `xml:"name,attr" json:"name,omitempty"`
	Label string `xml:",chardata"`
	Count int64  `xml:"count,attr" json:"count,omitempty"`
}

FacetValue is a value with the frequency that value occurs

type FieldReference

type FieldReference struct {
	XMLName   xml.Name `xml:"http://marklogic.com/appservices/search field" json:"-"`
	Name      string   `xml:"name,attr"`
	Collation string   `xml:"collation,attr"`
}

FieldReference represents http://docs.marklogic.com/guide/search-dev/structured-query#id_83393

type GeoAttrPairQuery

type GeoAttrPairQuery struct {
	XMLName      xml.Name    `xml:"http://marklogic.com/appservices/search geo-attr-pair-query" json:"-"`
	Parent       QueryParent `xml:"http://marklogic.com/appservices/search parent" json:"parent,omitempty"`
	Lat          Lat         `xml:"http://marklogic.com/appservices/search lat" json:"lat,omitempty"`
	Lon          Lon         `xml:"http://marklogic.com/appservices/search lon" json:"lon,omitempty"`
	GeoOptions   []string    `xml:"http://marklogic.com/appservices/search geo-option,omitempty" json:"geo-option,omitempty"`
	FacetOptions []string    `xml:"http://marklogic.com/appservices/search facet-option,omitempty" json:"facet-option,omitempty"`
	HeatMap      HeatMap     `xml:"http://marklogic.com/appservices/search heatmap,omitempty" json:"heatmap,omitempty"`
	Points       []*Point    `xml:"http://marklogic.com/appservices/search point,omitempty" json:"point,omitempty"`
	Boxes        []*Box      `xml:"http://marklogic.com/appservices/search box,omitempty" json:"box,omitempty"`
	Circles      []*Circle   `xml:"http://marklogic.com/appservices/search circle,omitempty" json:"circle,omitempty"`
	Polygons     []*Polygon  `xml:"http://marklogic.com/appservices/search polygon,omitempty" json:"polygon,omitempty"`
}

GeoAttrPairQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_67897

type GeoElemPairQuery

type GeoElemPairQuery struct {
	XMLName      xml.Name    `xml:"http://marklogic.com/appservices/search geo-elem-pair-query" json:"-"`
	Parent       QueryParent `xml:"http://marklogic.com/appservices/search parent,omitempty" json:"parent,omitempty"`
	Lat          Lat         `xml:"http://marklogic.com/appservices/search lat" json:"lat,omitempty"`
	Lon          Lon         `xml:"http://marklogic.com/appservices/search lon" json:"lon,omitempty"`
	GeoOptions   []string    `xml:"http://marklogic.com/appservices/search geo-option,omitempty" json:"geo-option,omitempty"`
	FacetOptions []string    `xml:"http://marklogic.com/appservices/search facet-option,omitempty" json:"facet-option,omitempty"`
	HeatMap      HeatMap     `xml:"http://marklogic.com/appservices/search heatmap,omitempty" json:"heatmap,omitempty"`
	Points       []*Point    `xml:"http://marklogic.com/appservices/search point,omitempty" json:"point,omitempty"`
	Boxes        []*Box      `xml:"http://marklogic.com/appservices/search box,omitempty" json:"box,omitempty"`
	Circles      []*Circle   `xml:"http://marklogic.com/appservices/search circle,omitempty" json:"circle,omitempty"`
	Polygons     []*Polygon  `xml:"http://marklogic.com/appservices/search polygon,omitempty" json:"polygon,omitempty"`
}

GeoElemPairQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_18303

type GeoElemQuery

type GeoElemQuery struct {
	XMLName      xml.Name     `xml:"http://marklogic.com/appservices/search geo-elem-query" json:"-"`
	Parent       QueryParent  `xml:"http://marklogic.com/appservices/search parent,omitempty" json:"parent,omitempty"`
	Element      QueryElement `xml:"http://marklogic.com/appservices/search element" json:"element,omitempty"`
	GeoOptions   []string     `xml:"http://marklogic.com/appservices/search geo-option,omitempty" json:"geo-option,omitempty"`
	FacetOptions []string     `xml:"http://marklogic.com/appservices/search facet-option,omitempty" json:"facet-option,omitempty"`
	HeatMap      HeatMap      `xml:"http://marklogic.com/appservices/search heatmap,omitempty" json:"heatmap,omitempty"`
	Points       []*Point     `xml:"http://marklogic.com/appservices/search point,omitempty" json:"point,omitempty"`
	Boxes        []*Box       `xml:"http://marklogic.com/appservices/search box,omitempty" json:"box,omitempty"`
	Circles      []*Circle    `xml:"http://marklogic.com/appservices/search circle,omitempty" json:"circle,omitempty"`
	Polygons     []*Polygon   `xml:"http://marklogic.com/appservices/search polygon,omitempty" json:"polygon,omitempty"`
}

GeoElemQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_87280

type GeoPathQuery

type GeoPathQuery struct {
	XMLName      xml.Name   `xml:"http://marklogic.com/appservices/search geo-path-query" json:"-"`
	PathIndex    string     `xml:"http://marklogic.com/appservices/search path-index,omitempty" json:"path-index,omitempty"`
	GeoOptions   []string   `xml:"http://marklogic.com/appservices/search geo-option,omitempty" json:"geo-option,omitempty"`
	FacetOptions []string   `xml:"http://marklogic.com/appservices/search facet-option,omitempty" json:"facet-option,omitempty"`
	HeatMap      HeatMap    `xml:"http://marklogic.com/appservices/search heatmap,omitempty" json:"heatmap,omitempty"`
	Points       []*Point   `xml:"http://marklogic.com/appservices/search point,omitempty" json:"point,omitempty"`
	Boxes        []*Box     `xml:"http://marklogic.com/appservices/search box,omitempty" json:"box,omitempty"`
	Circles      []*Circle  `xml:"http://marklogic.com/appservices/search circle,omitempty" json:"circle,omitempty"`
	Polygons     []*Polygon `xml:"http://marklogic.com/appservices/search polygon,omitempty" json:"polygon,omitempty"`
}

GeoPathQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_58782

type HeatMap

type HeatMap struct {
	XMLName xml.Name `xml:"http://marklogic.com/appservices/search heatmap" json:"-"`
	North   float64  `xml:"n,attr"`
	East    float64  `xml:"e,attr"`
	South   float64  `xml:"s,attr"`
	West    float64  `xml:"w,attr"`
	Latdivs int64    `xml:"latdivs,attr"`
	Londivs int64    `xml:"londivs,attr"`
}

HeatMap represents http://docs.marklogic.com/guide/search-dev/structured-query#id_87280

type Lat

type Lat struct {
	XMLName   xml.Name `xml:"http://marklogic.com/appservices/search lat" json:"-"`
	Namespace string   `xml:"ns,attr"`
	Local     string   `xml:"name,attr"`
}

Lat represents http://docs.marklogic.com/guide/search-dev/structured-query#id_18303

type LocksQuery

type LocksQuery struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search locks-query" json:"-"`
	Queries []interface{} `xml:",any" json:"queries"`
}

LocksQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_53441

func (*LocksQuery) UnmarshalXML

func (q *LocksQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML LocksQuery converts to XML

type Lon

type Lon struct {
	XMLName   xml.Name `xml:"http://marklogic.com/appservices/search lon" json:"-"`
	Namespace string   `xml:"ns,attr"`
	Local     string   `xml:"name,attr"`
}

Lon represents http://docs.marklogic.com/guide/search-dev/structured-query#id_18303

type Match

type Match struct {
	Path string
	Text []Text
}

Match is a path in document that matches the query

func (*Match) UnmarshalXML

func (m *Match) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML for Match struct in a special way to handle highlighting matching text

type MatchingQuery

type MatchingQuery struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search matching-query" json:"-"`
	Queries []interface{} `xml:",any" json:"queries"`
}

MatchingQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_25949

func (*MatchingQuery) UnmarshalXML

func (q *MatchingQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML MatchingQuery converts to XML

type NearQuery

type NearQuery struct {
	XMLName        xml.Name      `xml:"http://marklogic.com/appservices/search near-query" json:"-"`
	Queries        []interface{} `xml:",any" json:"queries"`
	Ordered        bool          `xml:"http://marklogic.com/appservices/search ordered,omitempty" json:"ordered,omitempty"`
	Distance       int64         `xml:"http://marklogic.com/appservices/search distance,omitempty" json:"distance,omitempty"`
	DistanceWeight float64       `xml:"http://marklogic.com/appservices/search distance-weight,omitempty" json:"distance-weight,omitempty"`
}

NearQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_48512

func (*NearQuery) UnmarshalXML

func (q *NearQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML NearQuery converts to XML

type NegativeQuery

type NegativeQuery struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search negative-query" json:"-"`
	Queries []interface{} `xml:",any" json:"queries"`
}

NegativeQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_65108

func (*NegativeQuery) UnmarshalXML

func (q *NegativeQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML NegativeQuery converts to XML

type NotInQuery

type NotInQuery struct {
	XMLName       xml.Name      `xml:"http://marklogic.com/appservices/search not-in-query" json:"-"`
	PositiveQuery PositiveQuery `xml:"http://marklogic.com/appservices/search positive-query" json:"positive-query,omitempty"`
	NegativeQuery NegativeQuery `xml:"http://marklogic.com/appservices/search negative-query" json:"negative-query,omitempty"`
}

NotInQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_90794

type NotQuery

type NotQuery struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search not-query" json:"-"`
	Queries []interface{} `xml:",any" json:"queries"`
}

NotQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_39488

func (*NotQuery) UnmarshalXML

func (q *NotQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML NotQuery converts to XML

type OrQuery

type OrQuery struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search or-query" json:"-"`
	Queries []interface{} `xml:",any" json:"queries"`
}

OrQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_64259

func (*OrQuery) UnmarshalXML

func (q *OrQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML OrQuery converts to XML

type Point

type Point struct {
	XMLName   xml.Name `xml:"http://marklogic.com/appservices/search point" json:"-"`
	Latitude  float64  `xml:"http://marklogic.com/appservices/search latitude" json:"latitude,omitempty"`
	Longitude float64  `xml:"http://marklogic.com/appservices/search longitude" json:"longitude,omitempty"`
}

Point represents http://docs.marklogic.com/guide/search-dev/structured-query#id_87280

type Polygon

type Polygon struct {
	XMLName xml.Name `xml:"http://marklogic.com/appservices/search polygon" json:"-"`
	Points  []*Point `xml:"http://marklogic.com/appservices/search point" json:"point,omitempty"`
}

Polygon represents http://docs.marklogic.com/guide/search-dev/structured-query#id_87280

type PositiveQuery

type PositiveQuery struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search positive-query" json:"-"`
	Queries []interface{} `xml:",any" json:"queries"`
}

PositiveQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_65108

func (*PositiveQuery) UnmarshalXML

func (q *PositiveQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML PositiveQuery converts to XML

type PropertiesQuery

type PropertiesQuery struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search properties-query" json:"-"`
	Queries []interface{} `xml:",any" json:"queries"`
}

PropertiesQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_67222

func (*PropertiesQuery) UnmarshalXML

func (q *PropertiesQuery) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML PropertiesQuery converts to XML

type Query

type Query struct {
	XMLName xml.Name      `xml:"http://marklogic.com/appservices/search query" json:"-"`
	Queries []interface{} `xml:",any" json:"queries"`
}

Query represents http://docs.marklogic.com/guide/search-dev/structured-query#id_85307

func (*Query) UnmarshalXML

func (q *Query) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML Query converts to XML

type QueryAttribute

type QueryAttribute struct {
	XMLName   xml.Name `xml:"http://marklogic.com/appservices/search attribute" json:"-"`
	Namespace string   `xml:"ns,attr"`
	Local     string   `xml:"name,attr"`
}

QueryAttribute represents http://docs.marklogic.com/guide/search-dev/structured-query#id_83393

type QueryElement

type QueryElement struct {
	XMLName   xml.Name `xml:"http://marklogic.com/appservices/search element" json:"-"`
	Namespace string   `xml:"ns,attr"`
	Local     string   `xml:"name,attr"`
}

QueryElement represents http://docs.marklogic.com/guide/search-dev/structured-query#id_87231

type QueryHandle

type QueryHandle struct {
	*bytes.Buffer
	Format int
	Query  Query
	// contains filtered or unexported fields
}

QueryHandle is a handle that places the results into a Query struct

func (*QueryHandle) Deserialize

func (qh *QueryHandle) Deserialize(bytes []byte)

Deserialize returns Query struct that represents XML or JSON

func (*QueryHandle) Deserialized

func (qh *QueryHandle) Deserialized() interface{}

Deserialized returns *Query as interface{}

func (*QueryHandle) Get

func (qh *QueryHandle) Get() *Query

Get returns *Query

func (*QueryHandle) GetFormat

func (qh *QueryHandle) GetFormat() int

GetFormat returns int that represents XML or JSON

func (*QueryHandle) Read

func (qh *QueryHandle) Read(bytes []byte) (n int, err error)

Read bytes

func (*QueryHandle) Serialize

func (qh *QueryHandle) Serialize(query interface{})

Serialize returns []byte of XML or JSON that represents the Query struct

func (*QueryHandle) Serialized

func (qh *QueryHandle) Serialized() string

Serialized returns string of XML or JSON

func (*QueryHandle) SetTimestamp

func (qh *QueryHandle) SetTimestamp(timestamp string)

SetTimestamp sets the timestamp

func (*QueryHandle) Timestamp

func (qh *QueryHandle) Timestamp() string

Timestamp retieves a timestamp

type QueryParent

type QueryParent struct {
	XMLName   xml.Name `xml:"http://marklogic.com/appservices/search parent" json:"-"`
	Namespace string   `xml:"ns,attr"`
	Local     string   `xml:"name,attr"`
}

QueryParent represents http://docs.marklogic.com/guide/search-dev/structured-query#id_87280

type RangeQuery

type RangeQuery struct {
	XMLName       xml.Name       `xml:"http://marklogic.com/appservices/search range-query" json:"-"`
	Element       QueryElement   `xml:"http://marklogic.com/appservices/search element,omitempty" json:"element,omitempty"`
	Attribute     QueryAttribute `xml:"http://marklogic.com/appservices/search attribute,omitempty" json:"attribute,omitempty"`
	JSONKey       string         `xml:"http://marklogic.com/appservices/search json-key,omitempty" json:"json-key,omitempty"`
	Field         FieldReference `xml:"http://marklogic.com/appservices/search field,omitempty" json:"field,omitempty"`
	PathIndex     string         `xml:"http://marklogic.com/appservices/search path-index,omitempty" json:"path-index,omitempty"`
	FragmentScope string         `xml:"http://marklogic.com/appservices/search fragment-scope,omitempty" json:"fragment-scope,omitempty"`
	Value         string         `xml:"http://marklogic.com/appservices/search value,omitempty" json:"value,omitempty"`
	RangeOperator string         `xml:"http://marklogic.com/appservices/search range-operator,omitempty" json:"range-operator,omitempty"`
	RangeOptions  []string       `xml:"http://marklogic.com/appservices/search range-option,omitempty" json:"range-option,omitempty"`
}

RangeQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_83393

type Response

type Response struct {
	Total      int64    `xml:"total,attr" json:"total,omitempty"`
	Start      int64    `xml:"start,attr" json:"start,omitempty"`
	PageLength int64    `xml:"page-length,attr" json:"page-length,omitempty"`
	Results    []Result `xml:"http://marklogic.com/appservices/search result" json:"result,omitempty"`
	Facets     []Facet  `xml:"http://marklogic.com/appservices/search facet" json:"facet,omitempty"`
}

Response represents a response from the search API

type ResponseHandle

type ResponseHandle struct {
	*bytes.Buffer
	Format int
	// contains filtered or unexported fields
}

ResponseHandle is a handle that places the results into a Response struct

func (*ResponseHandle) AcceptResponse

func (rh *ResponseHandle) AcceptResponse(resp *http.Response) error

AcceptResponse handles an *http.Response

func (*ResponseHandle) Deserialize

func (rh *ResponseHandle) Deserialize(bytes []byte)

Deserialize returns Response struct that represents XML or JSON

func (*ResponseHandle) Deserialized

func (rh *ResponseHandle) Deserialized() interface{}

Deserialized returns *Response as interface{}

func (*ResponseHandle) Get

func (rh *ResponseHandle) Get() *Response

Get returns *Response

func (*ResponseHandle) GetFormat

func (rh *ResponseHandle) GetFormat() int

GetFormat returns int that represents XML or JSON

func (*ResponseHandle) Serialize

func (rh *ResponseHandle) Serialize(response interface{})

Serialize returns []byte of XML or JSON that represents the Response struct

func (*ResponseHandle) Serialized

func (rh *ResponseHandle) Serialized() string

Serialized returns string of XML or JSON

func (*ResponseHandle) SetTimestamp

func (rh *ResponseHandle) SetTimestamp(timestamp string)

SetTimestamp sets the timestamp

func (*ResponseHandle) Timestamp

func (rh *ResponseHandle) Timestamp() string

Timestamp retieves a timestamp

type Result

type Result struct {
	URI        string    `xml:"uri,attr" json:"uri,omitempty"`
	Href       string    `xml:"href,attr" json:"href,omitempty"`
	MimeType   string    `xml:"mimetype,attr" json:"mimetype,omitempty"`
	Format     string    `xml:"format,attr" json:"format,omitempty"`
	Path       string    `xml:"path,attr" json:"path,omitempty"`
	Index      int64     `xml:"index,attr" json:"index,omitempty"`
	Score      int64     `xml:"score,attr" json:"score,omitempty"`
	Confidence float64   `xml:"confidence,attr" json:"confidence,omitempty"`
	Fitness    float64   `xml:"fitness,attr" json:"fitness,omitempty"`
	Snippets   []Snippet `xml:"http://marklogic.com/appservices/search snippet" json:"snippet,omitempty"`
}

Result is an individual document fragment found by the search

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is used for the search service

func NewService

func NewService(client *clients.Client) *Service

NewService returns a new search.Service

func (*Service) Delete

func (s *Service) Delete(parameters map[string]string, transaction *util.Transaction, response handle.ResponseHandle) error

Delete documents that match specified collection, directory, etc.

func (*Service) Search

func (s *Service) Search(text string, start int64, pageLength int64, transaction *util.Transaction, response handle.ResponseHandle) error

Search with text value

func (*Service) StructuredSearch

func (s *Service) StructuredSearch(query handle.Handle, start int64, pageLength int64, transaction *util.Transaction, response handle.ResponseHandle) error

StructuredSearch searches with a structured query

func (*Service) StructuredSuggestions

func (s *Service) StructuredSuggestions(query handle.Handle, partialQ string, limit int64, options string, transaction *util.Transaction, response handle.ResponseHandle) error

StructuredSuggestions suggests query text based off of a structured query

type Snippet

type Snippet struct {
	Location string  `xml:"uri,attr" json:"uri,omitempty"`
	Matches  []Match `xml:"http://marklogic.com/appservices/search match" json:"match,omitempty"`
}

Snippet represents a snippet

type SuggestionsResponse

type SuggestionsResponse struct {
	XMLName     xml.Name `xml:"http://marklogic.com/appservices/search suggestions" json:"-"`
	Suggestions []string `xml:"http://marklogic.com/appservices/search suggestion" json:"suggestions"`
}

SuggestionsResponse represents the search Suggestions from MarkLogic

type SuggestionsResponseHandle

type SuggestionsResponseHandle struct {
	*bytes.Buffer
	Format int
	// contains filtered or unexported fields
}

SuggestionsResponseHandle is a handle that places the results into a Query struct

func (*SuggestionsResponseHandle) AcceptResponse

func (srh *SuggestionsResponseHandle) AcceptResponse(resp *http.Response) error

AcceptResponse handles an *http.Response

func (*SuggestionsResponseHandle) Deserialize

func (srh *SuggestionsResponseHandle) Deserialize(bytes []byte)

Deserialize returns Query struct that represents XML or JSON

func (*SuggestionsResponseHandle) Deserialized

func (srh *SuggestionsResponseHandle) Deserialized() interface{}

Deserialized returns *SuggestionsResponse as interface{}

func (*SuggestionsResponseHandle) Get

Get returns *SuggestionsResponse

func (*SuggestionsResponseHandle) GetFormat

func (srh *SuggestionsResponseHandle) GetFormat() int

GetFormat returns int that represents XML or JSON

func (*SuggestionsResponseHandle) Serialize

func (srh *SuggestionsResponseHandle) Serialize(suggestionsResponse interface{})

Serialize returns []byte of XML or JSON that represents the Query struct

func (*SuggestionsResponseHandle) Serialized

func (srh *SuggestionsResponseHandle) Serialized() string

Serialized returns string of XML or JSON

func (*SuggestionsResponseHandle) SetTimestamp

func (srh *SuggestionsResponseHandle) SetTimestamp(timestamp string)

SetTimestamp sets the timestamp

func (*SuggestionsResponseHandle) Timestamp

func (srh *SuggestionsResponseHandle) Timestamp() string

Timestamp retieves a timestamp

type TermQuery

type TermQuery struct {
	XMLName xml.Name `xml:"http://marklogic.com/appservices/search term-query" json:"-"`
	Terms   []string `xml:"http://marklogic.com/appservices/search text" json:"text"`
	Weight  float64  `xml:"http://marklogic.com/appservices/search weight,omitempty" json:"weight,omitempty"`
}

TermQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_56027

type Text

type Text struct {
	Text            string
	HighlightedText bool
}

Text in a match. HightlightedText tells whether the text matched the query or not.

type ValueQuery

type ValueQuery struct {
	XMLName       xml.Name       `xml:"http://marklogic.com/appservices/search value-query" json:"-"`
	Element       QueryElement   `xml:"http://marklogic.com/appservices/search element,omitempty" json:"element,omitempty"`
	Attribute     QueryAttribute `xml:"http://marklogic.com/appservices/search attribute,omitempty" json:"attribute,omitempty"`
	JSONKey       string         `xml:"http://marklogic.com/appservices/search json-key,omitempty" json:"json-key,omitempty"`
	Field         FieldReference `xml:"http://marklogic.com/appservices/search field,omitempty" json:"field,omitempty"`
	FragmentScope string         `xml:"http://marklogic.com/appservices/search fragment-scope,omitempty" json:"fragment-scope,omitempty"`
	Text          []string       `xml:"http://marklogic.com/appservices/search text,omitempty" json:"text,omitempty"`
	TermOptions   []string       `xml:"http://marklogic.com/appservices/search term-option,omitempty" json:"term-option,omitempty"`
	Weight        float64        `xml:"http://marklogic.com/appservices/search weight,omitempty" json:"weight,omitempty"`
}

ValueQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_39758

type WordQuery

type WordQuery struct {
	XMLName       xml.Name       `xml:"http://marklogic.com/appservices/search word-query" json:"-"`
	Element       QueryElement   `xml:"http://marklogic.com/appservices/search element,omitempty" json:"element,omitempty"`
	Attribute     QueryAttribute `xml:"http://marklogic.com/appservices/search attribute,omitempty" json:"attribute,omitempty"`
	JSONKey       string         `xml:"http://marklogic.com/appservices/search json-key,omitempty" json:"json-key,omitempty"`
	Field         FieldReference `xml:"http://marklogic.com/appservices/search field,omitempty" json:"field,omitempty"`
	FragmentScope string         `xml:"http://marklogic.com/appservices/search fragment-scope,omitempty" json:"fragment-scope,omitempty"`
	Text          []string       `xml:"http://marklogic.com/appservices/search text,omitempty" json:"text,omitempty"`
	TermOptions   []string       `xml:"http://marklogic.com/appservices/search term-option,omitempty" json:"term-option,omitempty"`
	Weight        float64        `xml:"http://marklogic.com/appservices/search weight,omitempty" json:"weight,omitempty"`
}

WordQuery represents http://docs.marklogic.com/guide/search-dev/structured-query#id_18990

Jump to

Keyboard shortcuts

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