Documentation ¶
Overview ¶
Package cloudsearch provides access to the Google Cloud Search API.
Usage example:
import "google.golang.org/api/cloudsearch/v1" ... cloudsearchService, err := cloudsearch.New(oauthHttpClient)
Index ¶
- Constants
- type Document
- type Empty
- type FieldNames
- type FieldValue
- type FieldValueList
- type IndexInfo
- type ListDocumentsResponse
- type ListIndexesResponse
- type ProjectsIndexesDocumentsCreateCall
- type ProjectsIndexesDocumentsDeleteCall
- type ProjectsIndexesDocumentsGetCall
- type ProjectsIndexesDocumentsListCall
- func (c *ProjectsIndexesDocumentsListCall) Do() (*ListDocumentsResponse, error)
- func (c *ProjectsIndexesDocumentsListCall) Fields(s ...googleapi.Field) *ProjectsIndexesDocumentsListCall
- func (c *ProjectsIndexesDocumentsListCall) PageSize(pageSize int64) *ProjectsIndexesDocumentsListCall
- func (c *ProjectsIndexesDocumentsListCall) PageToken(pageToken string) *ProjectsIndexesDocumentsListCall
- func (c *ProjectsIndexesDocumentsListCall) View(view string) *ProjectsIndexesDocumentsListCall
- type ProjectsIndexesDocumentsService
- func (r *ProjectsIndexesDocumentsService) Create(projectId string, indexId string, document *Document) *ProjectsIndexesDocumentsCreateCall
- func (r *ProjectsIndexesDocumentsService) Delete(projectId string, indexId string, docId string) *ProjectsIndexesDocumentsDeleteCall
- func (r *ProjectsIndexesDocumentsService) Get(projectId string, indexId string, docId string) *ProjectsIndexesDocumentsGetCall
- func (r *ProjectsIndexesDocumentsService) List(projectId string, indexId string, pageSize int64, pageToken string, ...) *ProjectsIndexesDocumentsListCall
- type ProjectsIndexesListCall
- func (c *ProjectsIndexesListCall) Do() (*ListIndexesResponse, error)
- func (c *ProjectsIndexesListCall) Fields(s ...googleapi.Field) *ProjectsIndexesListCall
- func (c *ProjectsIndexesListCall) IndexNamePrefix(indexNamePrefix string) *ProjectsIndexesListCall
- func (c *ProjectsIndexesListCall) PageSize(pageSize int64) *ProjectsIndexesListCall
- func (c *ProjectsIndexesListCall) PageToken(pageToken string) *ProjectsIndexesListCall
- func (c *ProjectsIndexesListCall) View(view string) *ProjectsIndexesListCall
- type ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) Do() (*SearchResponse, error)
- func (c *ProjectsIndexesSearchCall) FieldExpressions(fieldExpressions string) *ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) Fields(s ...googleapi.Field) *ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) MatchedCountAccuracy(matchedCountAccuracy int64) *ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) Offset(offset int64) *ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) OrderBy(orderBy string) *ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) PageSize(pageSize int64) *ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) PageToken(pageToken string) *ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) Query(query string) *ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) ReturnFields(returnFields string) *ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) Scorer(scorer string) *ProjectsIndexesSearchCall
- func (c *ProjectsIndexesSearchCall) ScorerSize(scorerSize int64) *ProjectsIndexesSearchCall
- type ProjectsIndexesService
- type ProjectsService
- type SearchResponse
- type SearchResult
- type Service
Constants ¶
const ( // View and manage your data across Google Cloud Platform services CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" // FOR TESTING ONLY CloudsearchScope = "https://www.googleapis.com/auth/cloudsearch" // View your email address UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.email" )
OAuth2 scopes used by this API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct { // DocId: The unique identifier of the document. It must contain only // visible, printable ASCII characters (ASCII codes 33 through 126 // inclusive) and be no longer than 500 characters. It cannot begin with // an exclamation point ('!'), and it can't begin and end with double // underscores ("__"). If missing, it is automatically assigned for the // document. DocId string `json:"docId,omitempty"` // Fields: The list of fields in the document. It cannot be the empty // list. Each field has a name and a list of values. The field name is // unique to a document and is case sensitive. The name can only contain // ASCII characters. It must start with a letter and can contain // letters, digits, or underscore. It cannot be longer than 500 // characters and cannot be the empty string. A field can have multiple // values with same or different types, however, it cannot have multiple // Timestamp or number values. Fields map[string]FieldValueList `json:"fields,omitempty"` // Rank: A positive integer which determines the default ordering of // documents returned from a search. The rank can be set explicitly when // the document is created. It is a bad idea to assign the same rank to // many documents, and the same rank should never be assigned to more // than 10,000 documents. By default (when it is not specified or set to // 0), it is set at the time the document is created to the number of // seconds since January 1, 2011. The rank can be used in // field_expressions, order_by or return_fields in a search request, // where it is referenced as `_rank`. Rank int64 `json:"rank,omitempty"` }
type FieldNames ¶
type FieldNames struct { // AtomFields: The names of fields in which ATOM values are stored. AtomFields []string `json:"atomFields,omitempty"` // DateFields: The names of fields in which DATE values are stored. DateFields []string `json:"dateFields,omitempty"` // GeoFields: The names of fields in which GEO values are stored. GeoFields []string `json:"geoFields,omitempty"` // HtmlFields: The names of fields in which HTML values are stored. HtmlFields []string `json:"htmlFields,omitempty"` // NumberFields: The names of fields in which NUMBER values are stored. NumberFields []string `json:"numberFields,omitempty"` // TextFields: The names of fields in which TEXT values are stored. TextFields []string `json:"textFields,omitempty"` }
type FieldValue ¶
type FieldValue struct { // GeoValue: The value of a GEO-valued field, represented in string with // any of the listed [ways of writing // coordinates](http://en.wikipedia.org/wiki/Geographic_coordinate_conver // sion#Ways_of_writing_coordinates) GeoValue string `json:"geoValue,omitempty"` // Lang: The language of a string value. If given, the language must be // a valid `ISO 639-1` code. Lang string `json:"lang,omitempty"` // NumberValue: The value of a number-valued field. NumberValue float64 `json:"numberValue,omitempty"` // StringFormat: The format of a string value. By default, the string // format is `DEFAULT`, where a format will be automatically detected. StringFormat string `json:"stringFormat,omitempty"` // StringValue: The value of a string-valued field. StringValue string `json:"stringValue,omitempty"` // TimestampValue: The value of a timestamp-valued field. TimestampValue string `json:"timestampValue,omitempty"` }
type FieldValueList ¶
type FieldValueList struct { // Values: The list of typed values. Values []*FieldValue `json:"values,omitempty"` }
type IndexInfo ¶
type IndexInfo struct { // IndexId: The index identifier. It cannot be the empty string. It must // contain only visible, printable ASCII characters (ASCII codes 33 // through 126 inclusive) and be no longer than 100 characters. It // cannot begin with an exclamation point ('!'), and it can't begin and // end with double underscores ("__"). IndexId string `json:"indexId,omitempty"` // IndexedField: Names of indexed fields. IndexedField *FieldNames `json:"indexedField,omitempty"` // ProjectId: The project associated with the index. It cannot be the // empty string. ProjectId string `json:"projectId,omitempty"` }
type ListDocumentsResponse ¶
type ListDocumentsResponse struct { // Documents: The list of documents. Documents []*Document `json:"documents,omitempty"` // NextPageToken: If there are more results, retrieve them by invoking // list documents call with the same arguments and this `nextPageToken`. // If there are no more results, this field is not set. NextPageToken string `json:"nextPageToken,omitempty"` }
type ListIndexesResponse ¶
type ListIndexesResponse struct { // Indexes: The information about available indexes. Indexes []*IndexInfo `json:"indexes,omitempty"` // NextPageToken: If there are more results, retrieve them by invoking // list indexes call with the same arguments and this `nextPageToken`. // If there are no more results, this field is not set. NextPageToken string `json:"nextPageToken,omitempty"` }
type ProjectsIndexesDocumentsCreateCall ¶
type ProjectsIndexesDocumentsCreateCall struct {
// contains filtered or unexported fields
}
func (*ProjectsIndexesDocumentsCreateCall) Do ¶
func (c *ProjectsIndexesDocumentsCreateCall) Do() (*Document, error)
func (*ProjectsIndexesDocumentsCreateCall) Fields ¶
func (c *ProjectsIndexesDocumentsCreateCall) Fields(s ...googleapi.Field) *ProjectsIndexesDocumentsCreateCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
type ProjectsIndexesDocumentsDeleteCall ¶
type ProjectsIndexesDocumentsDeleteCall struct {
// contains filtered or unexported fields
}
func (*ProjectsIndexesDocumentsDeleteCall) Do ¶
func (c *ProjectsIndexesDocumentsDeleteCall) Do() (*Empty, error)
func (*ProjectsIndexesDocumentsDeleteCall) Fields ¶
func (c *ProjectsIndexesDocumentsDeleteCall) Fields(s ...googleapi.Field) *ProjectsIndexesDocumentsDeleteCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
type ProjectsIndexesDocumentsGetCall ¶
type ProjectsIndexesDocumentsGetCall struct {
// contains filtered or unexported fields
}
func (*ProjectsIndexesDocumentsGetCall) Do ¶
func (c *ProjectsIndexesDocumentsGetCall) Do() (*Document, error)
func (*ProjectsIndexesDocumentsGetCall) Fields ¶
func (c *ProjectsIndexesDocumentsGetCall) Fields(s ...googleapi.Field) *ProjectsIndexesDocumentsGetCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
type ProjectsIndexesDocumentsListCall ¶
type ProjectsIndexesDocumentsListCall struct {
// contains filtered or unexported fields
}
func (*ProjectsIndexesDocumentsListCall) Do ¶
func (c *ProjectsIndexesDocumentsListCall) Do() (*ListDocumentsResponse, error)
func (*ProjectsIndexesDocumentsListCall) Fields ¶
func (c *ProjectsIndexesDocumentsListCall) Fields(s ...googleapi.Field) *ProjectsIndexesDocumentsListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*ProjectsIndexesDocumentsListCall) PageSize ¶
func (c *ProjectsIndexesDocumentsListCall) PageSize(pageSize int64) *ProjectsIndexesDocumentsListCall
PageSize sets the optional parameter "pageSize": The maximum number of documents to return per page. If not specified, 100 documents are returned per page.
func (*ProjectsIndexesDocumentsListCall) PageToken ¶
func (c *ProjectsIndexesDocumentsListCall) PageToken(pageToken string) *ProjectsIndexesDocumentsListCall
PageToken sets the optional parameter "pageToken": A `nextPageToken` returned from previous list documents call as the starting point for this call. If not specified, list documents from the beginning.
func (*ProjectsIndexesDocumentsListCall) View ¶
func (c *ProjectsIndexesDocumentsListCall) View(view string) *ProjectsIndexesDocumentsListCall
View sets the optional parameter "view": Specifies which part of the document resource is returned in the response. If not specified, `ID_ONLY` is used.
type ProjectsIndexesDocumentsService ¶
type ProjectsIndexesDocumentsService struct {
// contains filtered or unexported fields
}
func NewProjectsIndexesDocumentsService ¶
func NewProjectsIndexesDocumentsService(s *Service) *ProjectsIndexesDocumentsService
func (*ProjectsIndexesDocumentsService) Create ¶
func (r *ProjectsIndexesDocumentsService) Create(projectId string, indexId string, document *Document) *ProjectsIndexesDocumentsCreateCall
Create: Inserts a document for indexing or updates an indexed document. The returned document contains only the ID of the new document. When `docId` is absent from the document, it is provided by the server.
func (*ProjectsIndexesDocumentsService) Delete ¶
func (r *ProjectsIndexesDocumentsService) Delete(projectId string, indexId string, docId string) *ProjectsIndexesDocumentsDeleteCall
Delete: Deletes a document from an index.
func (*ProjectsIndexesDocumentsService) Get ¶
func (r *ProjectsIndexesDocumentsService) Get(projectId string, indexId string, docId string) *ProjectsIndexesDocumentsGetCall
Get: Retrieves a document from an index.
func (*ProjectsIndexesDocumentsService) List ¶
func (r *ProjectsIndexesDocumentsService) List(projectId string, indexId string, pageSize int64, pageToken string, view string) *ProjectsIndexesDocumentsListCall
List: Lists documents in the specified search index. Intended for batch processing.
type ProjectsIndexesListCall ¶
type ProjectsIndexesListCall struct {
// contains filtered or unexported fields
}
func (*ProjectsIndexesListCall) Do ¶
func (c *ProjectsIndexesListCall) Do() (*ListIndexesResponse, error)
func (*ProjectsIndexesListCall) Fields ¶
func (c *ProjectsIndexesListCall) Fields(s ...googleapi.Field) *ProjectsIndexesListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*ProjectsIndexesListCall) IndexNamePrefix ¶
func (c *ProjectsIndexesListCall) IndexNamePrefix(indexNamePrefix string) *ProjectsIndexesListCall
IndexNamePrefix sets the optional parameter "indexNamePrefix": The prefix of the index name. It is used to list all indexes with names that have this prefix.
func (*ProjectsIndexesListCall) PageSize ¶
func (c *ProjectsIndexesListCall) PageSize(pageSize int64) *ProjectsIndexesListCall
PageSize sets the optional parameter "pageSize": The maximum number of indexes to return per page. If not specified, 100 indexes are returned per page.
func (*ProjectsIndexesListCall) PageToken ¶
func (c *ProjectsIndexesListCall) PageToken(pageToken string) *ProjectsIndexesListCall
PageToken sets the optional parameter "pageToken": A `nextPageToken` returned from previous list indexes call as the starting point for this call. If not specified, list indexes from the beginning.
func (*ProjectsIndexesListCall) View ¶
func (c *ProjectsIndexesListCall) View(view string) *ProjectsIndexesListCall
View sets the optional parameter "view": Specifies which parts of the IndexInfo resource is returned in the response. If not specified, `ID_ONLY` is used.
type ProjectsIndexesSearchCall ¶
type ProjectsIndexesSearchCall struct {
// contains filtered or unexported fields
}
func (*ProjectsIndexesSearchCall) Do ¶
func (c *ProjectsIndexesSearchCall) Do() (*SearchResponse, error)
func (*ProjectsIndexesSearchCall) FieldExpressions ¶
func (c *ProjectsIndexesSearchCall) FieldExpressions(fieldExpressions string) *ProjectsIndexesSearchCall
FieldExpressions sets the optional parameter "fieldExpressions": Customized expressions used in `orderBy` or `returnFields`. The expression can contain fields in `Document`, the built-in fields ( `_rank`, the document rank, and `_score` if scoring is enabled) and fields defined in `fieldExpressions`. Each field expression is represented in a json object with the following fields: * `name`: the name of the field expression in string. * `expression`: the expression to be computed. It can be a combination of supported functions encoded in string. Expressions involving number fields can use the arithmetical operators (`+`, `-`, `*`, `/`) and the built-in numeric functions (`max`, `min`, `pow`, `count`, `log`, `abs`). Expressions involving geopoint fields can use the `geopoint` and `distance` functions. Expressions for text and html fields can use the `snippet` function. For example: ``` fieldExpressions={name: "TotalPrice", expression: "(Price+Tax)"} ``` ``` fieldExpressions={name: "snippet", expression: "snippet('good times', content)"} ``` The field expression names can be used in `orderBy` and `returnFields` after they are defined in `fieldExpressions`.
func (*ProjectsIndexesSearchCall) Fields ¶
func (c *ProjectsIndexesSearchCall) Fields(s ...googleapi.Field) *ProjectsIndexesSearchCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*ProjectsIndexesSearchCall) MatchedCountAccuracy ¶
func (c *ProjectsIndexesSearchCall) MatchedCountAccuracy(matchedCountAccuracy int64) *ProjectsIndexesSearchCall
MatchedCountAccuracy sets the optional parameter "matchedCountAccuracy": Minimum accuracy requirement for `matchedCount` in search response. If specified, `matchedCount` will be accurate up to at least that number. For example, when set to 100, any `matchedCount <= 100` is accurate. This option may add considerable latency/expense. By default (when it is not specified or set to 0), the accuracy is the same as `pageSize`.
func (*ProjectsIndexesSearchCall) Offset ¶
func (c *ProjectsIndexesSearchCall) Offset(offset int64) *ProjectsIndexesSearchCall
Offset sets the optional parameter "offset": Offset is used to move to an arbitrary result, independent of the previous results. Offsets are inefficient when compared to `pageToken`. `pageToken` and `offset` cannot be both set. The default value of `offset` is 0.
func (*ProjectsIndexesSearchCall) OrderBy ¶
func (c *ProjectsIndexesSearchCall) OrderBy(orderBy string) *ProjectsIndexesSearchCall
OrderBy sets the optional parameter "orderBy": Comma-separated list of fields for sorting on the search result, including fields from `Document`, the built-in fields (`_rank` and `_score`), and fields defined in `fieldExpressions`. For example: `orderBy="foo,bar"`. The default sorting order is ascending. To specify descending order for a field, a suffix `" desc"` should be appended to the field name. For example: `orderBy="foo desc,bar"`. The default value for text sort is the empty string, and the default value for numeric sort is 0. If not specified, the search results are automatically sorted by descending `_rank`. Sorting by ascending `_rank` is not allowed.
func (*ProjectsIndexesSearchCall) PageSize ¶
func (c *ProjectsIndexesSearchCall) PageSize(pageSize int64) *ProjectsIndexesSearchCall
PageSize sets the optional parameter "pageSize": The maximum number of search results to return per page. Searches perform best when the `pageSize` is kept as small as possible. If not specified, 10 results are returned per page.
func (*ProjectsIndexesSearchCall) PageToken ¶
func (c *ProjectsIndexesSearchCall) PageToken(pageToken string) *ProjectsIndexesSearchCall
PageToken sets the optional parameter "pageToken": A `nextPageToken` returned from previous Search call as the starting point for this call. Pagination tokens provide better performance and consistency than offsets, and they cannot be used in combination with offsets.
func (*ProjectsIndexesSearchCall) Query ¶
func (c *ProjectsIndexesSearchCall) Query(query string) *ProjectsIndexesSearchCall
Query sets the optional parameter "query": The query string in search query syntax. If the query is missing or empty, all documents are returned.
func (*ProjectsIndexesSearchCall) ReturnFields ¶
func (c *ProjectsIndexesSearchCall) ReturnFields(returnFields string) *ProjectsIndexesSearchCall
ReturnFields sets the optional parameter "returnFields": List of fields to return in `SearchResult` objects. It can be fields from `Document`, the built-in fields `_rank` and `_score`, and fields defined in `fieldExpressions`. Use `"*"` to return all fields from `Document`.
func (*ProjectsIndexesSearchCall) Scorer ¶
func (c *ProjectsIndexesSearchCall) Scorer(scorer string) *ProjectsIndexesSearchCall
Scorer sets the optional parameter "scorer": The scoring function to invoke on a search result for this query. If `scorer` is not set, scoring is disabled and `_score` is 0 for all documents in the search result. To enable document relevancy score based on term frequency, set `"scorer=generic"`.
func (*ProjectsIndexesSearchCall) ScorerSize ¶
func (c *ProjectsIndexesSearchCall) ScorerSize(scorerSize int64) *ProjectsIndexesSearchCall
ScorerSize sets the optional parameter "scorerSize": Maximum number of top retrieved results to score. It is valid only when `scorer` is set. If not specified, 100 retrieved results are scored.
type ProjectsIndexesService ¶
type ProjectsIndexesService struct { Documents *ProjectsIndexesDocumentsService // contains filtered or unexported fields }
func NewProjectsIndexesService ¶
func NewProjectsIndexesService(s *Service) *ProjectsIndexesService
func (*ProjectsIndexesService) List ¶
func (r *ProjectsIndexesService) List(projectId string, indexNamePrefix string, pageSize int64, pageToken string, view string) *ProjectsIndexesListCall
List: Lists search indexes belonging to the specified project.
func (*ProjectsIndexesService) Search ¶
func (r *ProjectsIndexesService) Search(projectId string, indexId string, query string, fieldExpressions []string, pageSize int64, pageToken string, offset int64, matchedCountAccuracy int64, orderBy string, scorer string, scorerSize int64, returnFields []string) *ProjectsIndexesSearchCall
Search: Lists the documents in the named index that match the query.
type ProjectsService ¶
type ProjectsService struct { Indexes *ProjectsIndexesService // contains filtered or unexported fields }
func NewProjectsService ¶
func NewProjectsService(s *Service) *ProjectsService
type SearchResponse ¶
type SearchResponse struct { // MatchedCount: The number of documents that match the query. It is // greater than or equal to the number of documents actually returned. // This is an approximation and not an exact count unless it is less // than or equal to `matchedCountAccuracy` in search parameter. MatchedCount int64 `json:"matchedCount,omitempty,string"` // Results: The list of documents that match the search query. Results []*SearchResult `json:"results,omitempty"` }
type SearchResult ¶
type SearchResult struct { // DocId: The unique identifier of the document. DocId string `json:"docId,omitempty"` // Fields: The list of fields in the result. Each field is either from // the stored document, the built-in fields (`_rank`, the document rank, // and `_score` if scoring is enabled), or computed from any extra // `fieldExpressions` defined in the request. For example, if a request // contains a `fieldExpressions` named `"TotalPrice"` and expressed as // `"Price + Tax"`, the result will have a field whose name is // `"TotalPrice"` and whose value is set to the computed sum of the // value of field `"Price"` and the value of field `"Tax"`. If a request // contains a `fieldExpressions` named `"snippet"` and expressed as // `"snippet(\"good times\", content)"`, the result will have a field // whose name is `"snippet"` and whose value contains a snippet of text // from field `"content"` matching the query "good times". Fields map[string]FieldValueList `json:"fields,omitempty"` // NextPageToken: If there are more results, retrieve them by invoking // search call with the same arguments and this `nextPageToken`. If // there are no more results, this field is not set. NextPageToken string `json:"nextPageToken,omitempty"` }