4.0.0 • Published 5 years ago

@datafire/azure_search_searchindex v4.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@datafire/azure_search_searchindex

Client library for SearchIndexClient

Installation and Usage

npm install --save @datafire/azure_search_searchindex
let azure_search_searchindex = require('@datafire/azure_search_searchindex').create();

.then(data => {
  console.log(data);
});

Description

Client that can be used to query an index and upload, merge, or delete documents.

Actions

Documents_SearchGet

Searches for documents in the index.

azure_search_searchindex.Documents_SearchGet({
  "api-version": ""
}, context)

Input

  • input object
    • search string: A full-text search query expression; Use "*" or omit this parameter to match all documents.
    • $count boolean: A value that specifies whether to fetch the total count of results. Default is false. Setting this value to true may have a performance impact. Note that the count returned is an approximation.
    • facet array: The list of facet expressions to apply to the search query. Each facet expression contains a field name, optionally followed by a comma-separated list of name:value pairs.
    • $filter string: The OData $filter expression to apply to the search query.
    • highlight array: The list of field names to use for hit highlights. Only searchable fields can be used for hit highlighting.
    • highlightPostTag string: A string tag that is appended to hit highlights. Must be set with highlightPreTag. Default is </em>.
    • highlightPreTag string: A string tag that is prepended to hit highlights. Must be set with highlightPostTag. Default is <em>.
    • minimumCoverage number: A number between 0 and 100 indicating the percentage of the index that must be covered by a search query in order for the query to be reported as a success. This parameter can be useful for ensuring search availability even for services with only one replica. The default is 100.
    • $orderby array: The list of OData $orderby expressions by which to sort the results. Each expression can be either a field name or a call to either the geo.distance() or the search.score() functions. Each expression can be followed by asc to indicate ascending, and desc to indicate descending. The default is ascending order. Ties will be broken by the match scores of documents. If no OrderBy is specified, the default sort order is descending by document match score. There can be at most 32 $orderby clauses.
    • queryType string (values: simple, full): A value that specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the Lucene query syntax.
    • scoringParameter array: The list of parameter values to be used in scoring functions (for example, referencePointParameter) using the format name-values. For example, if the scoring profile defines a function with a parameter called 'mylocation' the parameter string would be "mylocation--122.2,44.8" (without the quotes).
    • scoringProfile string: The name of a scoring profile to evaluate match scores for matching documents in order to sort the results.
    • searchFields array: The list of field names to which to scope the full-text search. When using fielded search (fieldName:searchExpression) in a full Lucene query, the field names of each fielded search expression take precedence over any field names listed in this parameter.
    • searchMode string (values: any, all): A value that specifies whether any or all of the search terms must be matched in order to count the document as a match.
    • $select array: The list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema are included.
    • $skip integer: The number of search results to skip. This value cannot be greater than 100,000. If you need to scan documents in sequence, but cannot use $skip due to this limitation, consider using $orderby on a totally-ordered key and $filter with a range query instead.
    • $top integer: The number of search results to retrieve. This can be used in conjunction with $skip to implement client-side paging of search results. If results are truncated due to server-side paging, the response will include a continuation token that can be used to issue another Search request for the next page of results.
    • api-version required string: Client Api Version.
    • client-request-id string: The tracking ID sent with the request to help with debugging.

Output

Documents_Get

Retrieves a document from the index.

azure_search_searchindex.Documents_Get({
  "key": "",
  "api-version": ""
}, context)

Input

  • input object
    • key required string: The key of the document to retrieve.
    • $select array: List of field names to retrieve for the document; Any field not retrieved will be missing from the returned document.
    • api-version required string: Client Api Version.
    • client-request-id string: The tracking ID sent with the request to help with debugging.

Output

  • output object

Documents_Count

Queries the number of documents in the index.

azure_search_searchindex.Documents_Count({
  "api-version": ""
}, context)

Input

  • input object
    • client-request-id string: The tracking ID sent with the request to help with debugging.
    • api-version required string: Client Api Version.

Output

  • output integer

Documents_AutocompleteGet

Autocompletes incomplete query terms based on input text and matching terms in the index.

azure_search_searchindex.Documents_AutocompleteGet({
  "api-version": "",
  "search": "",
  "suggesterName": ""
}, context)

Input

  • input object
    • client-request-id string: The tracking ID sent with the request to help with debugging.
    • api-version required string: Client Api Version.
    • search required string: The incomplete term which should be auto-completed.
    • suggesterName required string: The name of the suggester as specified in the suggesters collection that's part of the index definition.
    • autocompleteMode string (values: oneTerm, twoTerms, oneTermWithContext): Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' to get shingles and 'oneTermWithContext' to use the current context while producing auto-completed terms.
    • $filter string: An OData expression that filters the documents used to produce completed terms for the Autocomplete result.
    • fuzzy boolean: A value indicating whether to use fuzzy matching for the autocomplete query. Default is false. When set to true, the query will find terms even if there's a substituted or missing character in the search text. While this provides a better experience in some scenarios, it comes at a performance cost as fuzzy autocomplete queries are slower and consume more resources.
    • highlightPostTag string: A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit highlighting is disabled.
    • highlightPreTag string: A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, hit highlighting is disabled.
    • minimumCoverage number: A number between 0 and 100 indicating the percentage of the index that must be covered by an autocomplete query in order for the query to be reported as a success. This parameter can be useful for ensuring search availability even for services with only one replica. The default is 80.
    • searchFields array: The list of field names to consider when querying for auto-completed terms. Target fields must be included in the specified suggester.
    • $top integer: The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The default is 5.

Output

Documents_Index

Sends a batch of document write actions to the index.

azure_search_searchindex.Documents_Index({
  "batch": null,
  "api-version": ""
}, context)

Input

  • input object
    • batch required IndexBatch
    • api-version required string: Client Api Version.
    • client-request-id string: The tracking ID sent with the request to help with debugging.

Output

Documents_AutocompletePost

Autocompletes incomplete query terms based on input text and matching terms in the index.

azure_search_searchindex.Documents_AutocompletePost({
  "api-version": "",
  "autocompleteRequest": null
}, context)

Input

  • input object
    • client-request-id string: The tracking ID sent with the request to help with debugging.
    • api-version required string: Client Api Version.
    • autocompleteRequest required AutocompleteRequest

Output

Documents_SearchPost

Searches for documents in the index.

azure_search_searchindex.Documents_SearchPost({
  "searchRequest": null,
  "api-version": ""
}, context)

Input

  • input object
    • searchRequest required SearchRequest
    • api-version required string: Client Api Version.
    • client-request-id string: The tracking ID sent with the request to help with debugging.

Output

Documents_SuggestPost

Suggests documents in the index that match the given partial query text.

azure_search_searchindex.Documents_SuggestPost({
  "suggestRequest": null,
  "api-version": ""
}, context)

Input

  • input object
    • suggestRequest required SuggestRequest
    • api-version required string: Client Api Version.
    • client-request-id string: The tracking ID sent with the request to help with debugging.

Output

Documents_SuggestGet

Suggests documents in the index that match the given partial query text.

azure_search_searchindex.Documents_SuggestGet({
  "search": "",
  "suggesterName": "",
  "api-version": ""
}, context)

Input

  • input object
    • search required string: The search text to use to suggest documents. Must be at least 1 character, and no more than 100 characters.
    • suggesterName required string: The name of the suggester as specified in the suggesters collection that's part of the index definition.
    • $filter string: An OData expression that filters the documents considered for suggestions.
    • fuzzy boolean: A value indicating whether to use fuzzy matching for the suggestions query. Default is false. When set to true, the query will find terms even if there's a substituted or missing character in the search text. While this provides a better experience in some scenarios, it comes at a performance cost as fuzzy suggestions queries are slower and consume more resources.
    • highlightPostTag string: A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit highlighting of suggestions is disabled.
    • highlightPreTag string: A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, hit highlighting of suggestions is disabled.
    • minimumCoverage number: A number between 0 and 100 indicating the percentage of the index that must be covered by a suggestions query in order for the query to be reported as a success. This parameter can be useful for ensuring search availability even for services with only one replica. The default is 80.
    • $orderby array: The list of OData $orderby expressions by which to sort the results. Each expression can be either a field name or a call to either the geo.distance() or the search.score() functions. Each expression can be followed by asc to indicate ascending, or desc to indicate descending. The default is ascending order. Ties will be broken by the match scores of documents. If no $orderby is specified, the default sort order is descending by document match score. There can be at most 32 $orderby clauses.
    • searchFields array: The list of field names to search for the specified search text. Target fields must be included in the specified suggester.
    • $select array: The list of fields to retrieve. If unspecified, only the key field will be included in the results.
    • $top integer: The number of suggestions to retrieve. The value must be a number between 1 and 100. The default is 5.
    • api-version required string: Client Api Version.
    • client-request-id string: The tracking ID sent with the request to help with debugging.

Output

Definitions

AutocompleteItem

  • AutocompleteItem object: The result of Autocomplete requests.
    • queryPlusText string: The query along with the completed term.
    • text string: The completed term.

AutocompleteMode

  • AutocompleteMode string (values: oneTerm, twoTerms, oneTermWithContext): Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' to get shingles and 'oneTermWithContext' to use the current context in producing autocomplete terms.

AutocompleteRequest

  • AutocompleteRequest object: Parameters for fuzzy matching, and other autocomplete query behaviors.
    • autocompleteMode AutocompleteMode
    • filter string: An OData expression that filters the documents used to produce completed terms for the Autocomplete result.
    • fuzzy boolean: A value indicating whether to use fuzzy matching for the autocomplete query. Default is false. When set to true, the query will autocomplete terms even if there's a substituted or missing character in the search text. While this provides a better experience in some scenarios, it comes at a performance cost as fuzzy autocomplete queries are slower and consume more resources.
    • highlightPostTag string: A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit highlighting is disabled.
    • highlightPreTag string: A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, hit highlighting is disabled.
    • minimumCoverage number: A number between 0 and 100 indicating the percentage of the index that must be covered by an autocomplete query in order for the query to be reported as a success. This parameter can be useful for ensuring search availability even for services with only one replica. The default is 80.
    • search string: The search text on which to base autocomplete results.
    • searchFields string: The comma-separated list of field names to consider when querying for auto-completed terms. Target fields must be included in the specified suggester.
    • suggesterName string: The name of the suggester as specified in the suggesters collection that's part of the index definition.
    • top integer: The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The default is 5.

AutocompleteResult

  • AutocompleteResult object: The result of Autocomplete query.

DocumentIndexResult

  • DocumentIndexResult object: Response containing the status of operations for all documents in the indexing request.
    • value array: The list of status information for each document in the indexing request.

DocumentSearchResult

  • DocumentSearchResult object: Response containing search results from an index.
    • @odata.count integer: The total count of results found by the search operation, or null if the count was not requested. If present, the count may be greater than the number of results in this response. This can happen if you use the $top or $skip parameters, or if Azure Cognitive Search can't return all the requested documents in a single Search response.
    • @odata.nextLink string: Continuation URL returned when Azure Cognitive Search can't return all the requested results in a single Search response. You can use this URL to formulate another GET or POST Search request to get the next part of the search response. Make sure to use the same verb (GET or POST) as the request that produced this response.
    • @search.coverage number: A value indicating the percentage of the index that was included in the query, or null if minimumCoverage was not specified in the request.
    • @search.facets object: The facet query results for the search operation, organized as a collection of buckets for each faceted field; null if the query did not include any facet expressions.
    • @search.nextPageParameters SearchRequest
    • value array: The sequence of results returned by the query.

DocumentSuggestResult

  • DocumentSuggestResult object: Response containing suggestion query results from an index.
    • @search.coverage number: A value indicating the percentage of the index that was included in the query, or null if minimumCoverage was not set in the request.
    • value array: The sequence of results returned by the query.

FacetResult

  • FacetResult object: A single bucket of a facet query result. Reports the number of documents with a field value falling within a particular range or having a particular value or interval.
    • count integer: The approximate count of documents falling within the bucket described by this facet.

IndexAction

  • IndexAction object: Represents an index action that operates on a document.
    • @search.action string (values: upload, merge, mergeOrUpload, delete): The operation to perform on a document in an indexing batch.

IndexBatch

  • IndexBatch object: Contains a batch of document write actions to send to the index.
    • value required array: The actions in the batch.

IndexingResult

  • IndexingResult object: Status of an indexing operation for a single document.
    • errorMessage string: The error message explaining why the indexing operation failed for the document identified by the key; null if indexing succeeded.
    • key string: The key of a document that was in the indexing request.
    • status boolean: A value indicating whether the indexing operation succeeded for the document identified by the key.
    • statusCode integer: The status code of the indexing operation. Possible values include: 200 for a successful update or delete, 201 for successful document creation, 400 for a malformed input document, 404 for document not found, 409 for a version conflict, 422 when the index is temporarily unavailable, or 503 for when the service is too busy.

QueryType

  • QueryType string (values: simple, full): Specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the Lucene query syntax.

SearchMode

  • SearchMode string (values: any, all): Specifies whether any or all of the search terms must be matched in order to count the document as a match.

SearchRequest

  • SearchRequest object: Parameters for filtering, sorting, faceting, paging, and other search query behaviors.
    • count boolean: A value that specifies whether to fetch the total count of results. Default is false. Setting this value to true may have a performance impact. Note that the count returned is an approximation.
    • facets array: The list of facet expressions to apply to the search query. Each facet expression contains a field name, optionally followed by a comma-separated list of name:value pairs.
      • items string
    • filter string: The OData $filter expression to apply to the search query.
    • highlight string: The comma-separated list of field names to use for hit highlights. Only searchable fields can be used for hit highlighting.
    • highlightPostTag string: A string tag that is appended to hit highlights. Must be set with highlightPreTag. Default is </em>.
    • highlightPreTag string: A string tag that is prepended to hit highlights. Must be set with highlightPostTag. Default is <em>.
    • minimumCoverage number: A number between 0 and 100 indicating the percentage of the index that must be covered by a search query in order for the query to be reported as a success. This parameter can be useful for ensuring search availability even for services with only one replica. The default is 100.
    • orderby string: The comma-separated list of OData $orderby expressions by which to sort the results. Each expression can be either a field name or a call to either the geo.distance() or the search.score() functions. Each expression can be followed by asc to indicate ascending, or desc to indicate descending. The default is ascending order. Ties will be broken by the match scores of documents. If no $orderby is specified, the default sort order is descending by document match score. There can be at most 32 $orderby clauses.
    • queryType QueryType
    • scoringParameters array: The list of parameter values to be used in scoring functions (for example, referencePointParameter) using the format name-values. For example, if the scoring profile defines a function with a parameter called 'mylocation' the parameter string would be "mylocation--122.2,44.8" (without the quotes).
      • items string
    • scoringProfile string: The name of a scoring profile to evaluate match scores for matching documents in order to sort the results.
    • search string: A full-text search query expression; Use "*" or omit this parameter to match all documents.
    • searchFields string: The comma-separated list of field names to which to scope the full-text search. When using fielded search (fieldName:searchExpression) in a full Lucene query, the field names of each fielded search expression take precedence over any field names listed in this parameter.
    • searchMode SearchMode
    • select string: The comma-separated list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema are included.
    • skip integer: The number of search results to skip. This value cannot be greater than 100,000. If you need to scan documents in sequence, but cannot use skip due to this limitation, consider using orderby on a totally-ordered key and filter with a range query instead.
    • top integer: The number of search results to retrieve. This can be used in conjunction with $skip to implement client-side paging of search results. If results are truncated due to server-side paging, the response will include a continuation token that can be used to issue another Search request for the next page of results.

SearchResult

  • SearchResult object: Contains a document found by a search query, plus associated metadata.
    • @search.highlights object: Text fragments from the document that indicate the matching search terms, organized by each applicable field; null if hit highlighting was not enabled for the query.
    • @search.score number: The relevance score of the document compared to other documents returned by the query.

SuggestRequest

  • SuggestRequest object: Parameters for filtering, sorting, fuzzy matching, and other suggestions query behaviors.
    • filter string: An OData expression that filters the documents considered for suggestions.
    • fuzzy boolean: A value indicating whether to use fuzzy matching for the suggestion query. Default is false. When set to true, the query will find suggestions even if there's a substituted or missing character in the search text. While this provides a better experience in some scenarios, it comes at a performance cost as fuzzy suggestion searches are slower and consume more resources.
    • highlightPostTag string: A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit highlighting of suggestions is disabled.
    • highlightPreTag string: A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, hit highlighting of suggestions is disabled.
    • minimumCoverage number: A number between 0 and 100 indicating the percentage of the index that must be covered by a suggestion query in order for the query to be reported as a success. This parameter can be useful for ensuring search availability even for services with only one replica. The default is 80.
    • orderby string: The comma-separated list of OData $orderby expressions by which to sort the results. Each expression can be either a field name or a call to either the geo.distance() or the search.score() functions. Each expression can be followed by asc to indicate ascending, or desc to indicate descending. The default is ascending order. Ties will be broken by the match scores of documents. If no $orderby is specified, the default sort order is descending by document match score. There can be at most 32 $orderby clauses.
    • search string: The search text to use to suggest documents. Must be at least 1 character, and no more than 100 characters.
    • searchFields string: The comma-separated list of field names to search for the specified search text. Target fields must be included in the specified suggester.
    • select string: The comma-separated list of fields to retrieve. If unspecified, only the key field will be included in the results.
    • suggesterName string: The name of the suggester as specified in the suggesters collection that's part of the index definition.
    • top integer: The number of suggestions to retrieve. This must be a value between 1 and 100. The default is 5.

SuggestResult

  • SuggestResult object: A result containing a document found by a suggestion query, plus associated metadata.
    • @search.text string: The text of the suggestion result.