com.amazonaws.services.kendra.model.QueryRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-kendra Show documentation
/*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.kendra.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class QueryRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* The unique identifier of the index to search. The identifier is returned in the response from the operation.
*
*/
private String indexId;
/**
*
* The text to search for.
*
*/
private String queryText;
/**
*
* Enables filtered searches based on document attributes. You can only provide one attribute filter; however, the
* AndAllFilters
, NotFilter
, and OrAllFilters
parameters contain a list of
* other filters.
*
*
* The AttributeFilter
parameter enables you to create a set of filtering rules that a document must
* satisfy to be included in the query results.
*
*/
private AttributeFilter attributeFilter;
/**
*
* An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. You can use
* this information to help narrow the search for your user.
*
*/
private java.util.List facets;
/**
*
* An array of document attributes to include in the response. No other document attributes are included in the
* response. By default all document attributes are included in the response.
*
*/
private java.util.List requestedDocumentAttributes;
/**
*
* Sets the type of query. Only results for the specified query type are returned.
*
*/
private String queryResultTypeFilter;
/**
*
* Query results are returned in pages the size of the PageSize
parameter. By default, Amazon Kendra
* returns the first page of results. Use this parameter to get result pages after the first one.
*
*/
private Integer pageNumber;
/**
*
* Sets the number of results that are returned in each page of results. The default page size is 100.
*
*/
private Integer pageSize;
/**
*
* The unique identifier of the index to search. The identifier is returned in the response from the operation.
*
*
* @param indexId
* The unique identifier of the index to search. The identifier is returned in the response from the
* operation.
*/
public void setIndexId(String indexId) {
this.indexId = indexId;
}
/**
*
* The unique identifier of the index to search. The identifier is returned in the response from the operation.
*
*
* @return The unique identifier of the index to search. The identifier is returned in the response from the
* operation.
*/
public String getIndexId() {
return this.indexId;
}
/**
*
* The unique identifier of the index to search. The identifier is returned in the response from the operation.
*
*
* @param indexId
* The unique identifier of the index to search. The identifier is returned in the response from the
* operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryRequest withIndexId(String indexId) {
setIndexId(indexId);
return this;
}
/**
*
* The text to search for.
*
*
* @param queryText
* The text to search for.
*/
public void setQueryText(String queryText) {
this.queryText = queryText;
}
/**
*
* The text to search for.
*
*
* @return The text to search for.
*/
public String getQueryText() {
return this.queryText;
}
/**
*
* The text to search for.
*
*
* @param queryText
* The text to search for.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryRequest withQueryText(String queryText) {
setQueryText(queryText);
return this;
}
/**
*
* Enables filtered searches based on document attributes. You can only provide one attribute filter; however, the
* AndAllFilters
, NotFilter
, and OrAllFilters
parameters contain a list of
* other filters.
*
*
* The AttributeFilter
parameter enables you to create a set of filtering rules that a document must
* satisfy to be included in the query results.
*
*
* @param attributeFilter
* Enables filtered searches based on document attributes. You can only provide one attribute filter;
* however, the AndAllFilters
, NotFilter
, and OrAllFilters
parameters
* contain a list of other filters.
*
* The AttributeFilter
parameter enables you to create a set of filtering rules that a document
* must satisfy to be included in the query results.
*/
public void setAttributeFilter(AttributeFilter attributeFilter) {
this.attributeFilter = attributeFilter;
}
/**
*
* Enables filtered searches based on document attributes. You can only provide one attribute filter; however, the
* AndAllFilters
, NotFilter
, and OrAllFilters
parameters contain a list of
* other filters.
*
*
* The AttributeFilter
parameter enables you to create a set of filtering rules that a document must
* satisfy to be included in the query results.
*
*
* @return Enables filtered searches based on document attributes. You can only provide one attribute filter;
* however, the AndAllFilters
, NotFilter
, and OrAllFilters
parameters
* contain a list of other filters.
*
* The AttributeFilter
parameter enables you to create a set of filtering rules that a document
* must satisfy to be included in the query results.
*/
public AttributeFilter getAttributeFilter() {
return this.attributeFilter;
}
/**
*
* Enables filtered searches based on document attributes. You can only provide one attribute filter; however, the
* AndAllFilters
, NotFilter
, and OrAllFilters
parameters contain a list of
* other filters.
*
*
* The AttributeFilter
parameter enables you to create a set of filtering rules that a document must
* satisfy to be included in the query results.
*
*
* @param attributeFilter
* Enables filtered searches based on document attributes. You can only provide one attribute filter;
* however, the AndAllFilters
, NotFilter
, and OrAllFilters
parameters
* contain a list of other filters.
*
* The AttributeFilter
parameter enables you to create a set of filtering rules that a document
* must satisfy to be included in the query results.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryRequest withAttributeFilter(AttributeFilter attributeFilter) {
setAttributeFilter(attributeFilter);
return this;
}
/**
*
* An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. You can use
* this information to help narrow the search for your user.
*
*
* @return An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. You can
* use this information to help narrow the search for your user.
*/
public java.util.List getFacets() {
return facets;
}
/**
*
* An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. You can use
* this information to help narrow the search for your user.
*
*
* @param facets
* An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. You can
* use this information to help narrow the search for your user.
*/
public void setFacets(java.util.Collection facets) {
if (facets == null) {
this.facets = null;
return;
}
this.facets = new java.util.ArrayList(facets);
}
/**
*
* An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. You can use
* this information to help narrow the search for your user.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setFacets(java.util.Collection)} or {@link #withFacets(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param facets
* An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. You can
* use this information to help narrow the search for your user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryRequest withFacets(Facet... facets) {
if (this.facets == null) {
setFacets(new java.util.ArrayList(facets.length));
}
for (Facet ele : facets) {
this.facets.add(ele);
}
return this;
}
/**
*
* An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. You can use
* this information to help narrow the search for your user.
*
*
* @param facets
* An array of documents attributes. Amazon Kendra returns a count for each attribute key specified. You can
* use this information to help narrow the search for your user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryRequest withFacets(java.util.Collection facets) {
setFacets(facets);
return this;
}
/**
*
* An array of document attributes to include in the response. No other document attributes are included in the
* response. By default all document attributes are included in the response.
*
*
* @return An array of document attributes to include in the response. No other document attributes are included in
* the response. By default all document attributes are included in the response.
*/
public java.util.List getRequestedDocumentAttributes() {
return requestedDocumentAttributes;
}
/**
*
* An array of document attributes to include in the response. No other document attributes are included in the
* response. By default all document attributes are included in the response.
*
*
* @param requestedDocumentAttributes
* An array of document attributes to include in the response. No other document attributes are included in
* the response. By default all document attributes are included in the response.
*/
public void setRequestedDocumentAttributes(java.util.Collection requestedDocumentAttributes) {
if (requestedDocumentAttributes == null) {
this.requestedDocumentAttributes = null;
return;
}
this.requestedDocumentAttributes = new java.util.ArrayList(requestedDocumentAttributes);
}
/**
*
* An array of document attributes to include in the response. No other document attributes are included in the
* response. By default all document attributes are included in the response.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setRequestedDocumentAttributes(java.util.Collection)} or
* {@link #withRequestedDocumentAttributes(java.util.Collection)} if you want to override the existing values.
*
*
* @param requestedDocumentAttributes
* An array of document attributes to include in the response. No other document attributes are included in
* the response. By default all document attributes are included in the response.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryRequest withRequestedDocumentAttributes(String... requestedDocumentAttributes) {
if (this.requestedDocumentAttributes == null) {
setRequestedDocumentAttributes(new java.util.ArrayList(requestedDocumentAttributes.length));
}
for (String ele : requestedDocumentAttributes) {
this.requestedDocumentAttributes.add(ele);
}
return this;
}
/**
*
* An array of document attributes to include in the response. No other document attributes are included in the
* response. By default all document attributes are included in the response.
*
*
* @param requestedDocumentAttributes
* An array of document attributes to include in the response. No other document attributes are included in
* the response. By default all document attributes are included in the response.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryRequest withRequestedDocumentAttributes(java.util.Collection requestedDocumentAttributes) {
setRequestedDocumentAttributes(requestedDocumentAttributes);
return this;
}
/**
*
* Sets the type of query. Only results for the specified query type are returned.
*
*
* @param queryResultTypeFilter
* Sets the type of query. Only results for the specified query type are returned.
* @see QueryResultType
*/
public void setQueryResultTypeFilter(String queryResultTypeFilter) {
this.queryResultTypeFilter = queryResultTypeFilter;
}
/**
*
* Sets the type of query. Only results for the specified query type are returned.
*
*
* @return Sets the type of query. Only results for the specified query type are returned.
* @see QueryResultType
*/
public String getQueryResultTypeFilter() {
return this.queryResultTypeFilter;
}
/**
*
* Sets the type of query. Only results for the specified query type are returned.
*
*
* @param queryResultTypeFilter
* Sets the type of query. Only results for the specified query type are returned.
* @return Returns a reference to this object so that method calls can be chained together.
* @see QueryResultType
*/
public QueryRequest withQueryResultTypeFilter(String queryResultTypeFilter) {
setQueryResultTypeFilter(queryResultTypeFilter);
return this;
}
/**
*
* Sets the type of query. Only results for the specified query type are returned.
*
*
* @param queryResultTypeFilter
* Sets the type of query. Only results for the specified query type are returned.
* @return Returns a reference to this object so that method calls can be chained together.
* @see QueryResultType
*/
public QueryRequest withQueryResultTypeFilter(QueryResultType queryResultTypeFilter) {
this.queryResultTypeFilter = queryResultTypeFilter.toString();
return this;
}
/**
*
* Query results are returned in pages the size of the PageSize
parameter. By default, Amazon Kendra
* returns the first page of results. Use this parameter to get result pages after the first one.
*
*
* @param pageNumber
* Query results are returned in pages the size of the PageSize
parameter. By default, Amazon
* Kendra returns the first page of results. Use this parameter to get result pages after the first one.
*/
public void setPageNumber(Integer pageNumber) {
this.pageNumber = pageNumber;
}
/**
*
* Query results are returned in pages the size of the PageSize
parameter. By default, Amazon Kendra
* returns the first page of results. Use this parameter to get result pages after the first one.
*
*
* @return Query results are returned in pages the size of the PageSize
parameter. By default, Amazon
* Kendra returns the first page of results. Use this parameter to get result pages after the first one.
*/
public Integer getPageNumber() {
return this.pageNumber;
}
/**
*
* Query results are returned in pages the size of the PageSize
parameter. By default, Amazon Kendra
* returns the first page of results. Use this parameter to get result pages after the first one.
*
*
* @param pageNumber
* Query results are returned in pages the size of the PageSize
parameter. By default, Amazon
* Kendra returns the first page of results. Use this parameter to get result pages after the first one.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryRequest withPageNumber(Integer pageNumber) {
setPageNumber(pageNumber);
return this;
}
/**
*
* Sets the number of results that are returned in each page of results. The default page size is 100.
*
*
* @param pageSize
* Sets the number of results that are returned in each page of results. The default page size is 100.
*/
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
/**
*
* Sets the number of results that are returned in each page of results. The default page size is 100.
*
*
* @return Sets the number of results that are returned in each page of results. The default page size is 100.
*/
public Integer getPageSize() {
return this.pageSize;
}
/**
*
* Sets the number of results that are returned in each page of results. The default page size is 100.
*
*
* @param pageSize
* Sets the number of results that are returned in each page of results. The default page size is 100.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryRequest withPageSize(Integer pageSize) {
setPageSize(pageSize);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getIndexId() != null)
sb.append("IndexId: ").append(getIndexId()).append(",");
if (getQueryText() != null)
sb.append("QueryText: ").append(getQueryText()).append(",");
if (getAttributeFilter() != null)
sb.append("AttributeFilter: ").append(getAttributeFilter()).append(",");
if (getFacets() != null)
sb.append("Facets: ").append(getFacets()).append(",");
if (getRequestedDocumentAttributes() != null)
sb.append("RequestedDocumentAttributes: ").append(getRequestedDocumentAttributes()).append(",");
if (getQueryResultTypeFilter() != null)
sb.append("QueryResultTypeFilter: ").append(getQueryResultTypeFilter()).append(",");
if (getPageNumber() != null)
sb.append("PageNumber: ").append(getPageNumber()).append(",");
if (getPageSize() != null)
sb.append("PageSize: ").append(getPageSize());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof QueryRequest == false)
return false;
QueryRequest other = (QueryRequest) obj;
if (other.getIndexId() == null ^ this.getIndexId() == null)
return false;
if (other.getIndexId() != null && other.getIndexId().equals(this.getIndexId()) == false)
return false;
if (other.getQueryText() == null ^ this.getQueryText() == null)
return false;
if (other.getQueryText() != null && other.getQueryText().equals(this.getQueryText()) == false)
return false;
if (other.getAttributeFilter() == null ^ this.getAttributeFilter() == null)
return false;
if (other.getAttributeFilter() != null && other.getAttributeFilter().equals(this.getAttributeFilter()) == false)
return false;
if (other.getFacets() == null ^ this.getFacets() == null)
return false;
if (other.getFacets() != null && other.getFacets().equals(this.getFacets()) == false)
return false;
if (other.getRequestedDocumentAttributes() == null ^ this.getRequestedDocumentAttributes() == null)
return false;
if (other.getRequestedDocumentAttributes() != null && other.getRequestedDocumentAttributes().equals(this.getRequestedDocumentAttributes()) == false)
return false;
if (other.getQueryResultTypeFilter() == null ^ this.getQueryResultTypeFilter() == null)
return false;
if (other.getQueryResultTypeFilter() != null && other.getQueryResultTypeFilter().equals(this.getQueryResultTypeFilter()) == false)
return false;
if (other.getPageNumber() == null ^ this.getPageNumber() == null)
return false;
if (other.getPageNumber() != null && other.getPageNumber().equals(this.getPageNumber()) == false)
return false;
if (other.getPageSize() == null ^ this.getPageSize() == null)
return false;
if (other.getPageSize() != null && other.getPageSize().equals(this.getPageSize()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getIndexId() == null) ? 0 : getIndexId().hashCode());
hashCode = prime * hashCode + ((getQueryText() == null) ? 0 : getQueryText().hashCode());
hashCode = prime * hashCode + ((getAttributeFilter() == null) ? 0 : getAttributeFilter().hashCode());
hashCode = prime * hashCode + ((getFacets() == null) ? 0 : getFacets().hashCode());
hashCode = prime * hashCode + ((getRequestedDocumentAttributes() == null) ? 0 : getRequestedDocumentAttributes().hashCode());
hashCode = prime * hashCode + ((getQueryResultTypeFilter() == null) ? 0 : getQueryResultTypeFilter().hashCode());
hashCode = prime * hashCode + ((getPageNumber() == null) ? 0 : getPageNumber().hashCode());
hashCode = prime * hashCode + ((getPageSize() == null) ? 0 : getPageSize().hashCode());
return hashCode;
}
@Override
public QueryRequest clone() {
return (QueryRequest) super.clone();
}
}