Constructing a Basic Search Query

Query constraints can be specified in a number of ways. In the simplest case, a text string is provided and is used as a query constraint to find items that contain the specified text in the default search field. For example, you could specify the query constraint q=read+write to retrieve a list of the items that contain the terms "read" and "write" in any text field:


You can specify additional constraints to search specific fields and use Boolean logic to construct more complex queries. When you search text fields, ASN Search finds all items that contain the search terms anywhere within the specified field. If the field being searched is a literal field, the field contents must exactly match the search string to be returned in results. You can also search uint fields for a particular value or a range of values.

In your search requests, you can also specify how you want ASN Search to rank and return the search hits. Instead of using the default text_relevance scores, you can rank hits alphabetically, or numerically.

When you submit a search request, ASN Search returns a response that specifies how the results were ranked, the match expression that was derived from your query constraints, and a collection of hits that represents the items that match the query constraints. For example:

    "match-expr":"(label 'read write')",

found—specifies the total number of items that matched the query.

start—specifies the offset of the first hit included in the response.

id—specifies the unique item ID of an individual hit.

By default, a search response contains the IDs of the first 10 ranked hits. You can retrieve additional information for each hit by specifying which result enabled fields should be included in the response. You can also control how many hits are returned at a time. When you want to page through a large set of matching documents, you can specify the offset of the first hit that you want to retrieve.

For more information, see Controlling How Search Results are Returned.