com.amazonaws.services.kendra.model.SortingConfiguration Maven / Gradle / Ivy
Show all versions of aws-java-sdk-kendra Show documentation
/*
* Copyright 2019-2024 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.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Specifies the document attribute to use to sort the response to a Amazon Kendra query. You can specify a single
* attribute for sorting. The attribute must have the Sortable
flag set to true
, otherwise
* Amazon Kendra returns an exception.
*
*
* You can sort attributes of the following types.
*
*
* -
*
* Date value
*
*
* -
*
* Long value
*
*
* -
*
* String value
*
*
*
*
* You can't sort attributes of the following type.
*
*
* -
*
* String list value
*
*
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SortingConfiguration implements Serializable, Cloneable, StructuredPojo {
/**
*
* The name of the document attribute used to sort the response. You can use any field that has the
* Sortable
flag set to true.
*
*
* You can also sort by any of the following built-in attributes:
*
*
* -
*
* _category
*
*
* -
*
* _created_at
*
*
* -
*
* _last_updated_at
*
*
* -
*
* _version
*
*
* -
*
* _view_count
*
*
*
*/
private String documentAttributeKey;
/**
*
* The order that the results should be returned in. In case of ties, the relevance assigned to the result by Amazon
* Kendra is used as the tie-breaker.
*
*/
private String sortOrder;
/**
*
* The name of the document attribute used to sort the response. You can use any field that has the
* Sortable
flag set to true.
*
*
* You can also sort by any of the following built-in attributes:
*
*
* -
*
* _category
*
*
* -
*
* _created_at
*
*
* -
*
* _last_updated_at
*
*
* -
*
* _version
*
*
* -
*
* _view_count
*
*
*
*
* @param documentAttributeKey
* The name of the document attribute used to sort the response. You can use any field that has the
* Sortable
flag set to true.
*
* You can also sort by any of the following built-in attributes:
*
*
* -
*
* _category
*
*
* -
*
* _created_at
*
*
* -
*
* _last_updated_at
*
*
* -
*
* _version
*
*
* -
*
* _view_count
*
*
*/
public void setDocumentAttributeKey(String documentAttributeKey) {
this.documentAttributeKey = documentAttributeKey;
}
/**
*
* The name of the document attribute used to sort the response. You can use any field that has the
* Sortable
flag set to true.
*
*
* You can also sort by any of the following built-in attributes:
*
*
* -
*
* _category
*
*
* -
*
* _created_at
*
*
* -
*
* _last_updated_at
*
*
* -
*
* _version
*
*
* -
*
* _view_count
*
*
*
*
* @return The name of the document attribute used to sort the response. You can use any field that has the
* Sortable
flag set to true.
*
* You can also sort by any of the following built-in attributes:
*
*
* -
*
* _category
*
*
* -
*
* _created_at
*
*
* -
*
* _last_updated_at
*
*
* -
*
* _version
*
*
* -
*
* _view_count
*
*
*/
public String getDocumentAttributeKey() {
return this.documentAttributeKey;
}
/**
*
* The name of the document attribute used to sort the response. You can use any field that has the
* Sortable
flag set to true.
*
*
* You can also sort by any of the following built-in attributes:
*
*
* -
*
* _category
*
*
* -
*
* _created_at
*
*
* -
*
* _last_updated_at
*
*
* -
*
* _version
*
*
* -
*
* _view_count
*
*
*
*
* @param documentAttributeKey
* The name of the document attribute used to sort the response. You can use any field that has the
* Sortable
flag set to true.
*
* You can also sort by any of the following built-in attributes:
*
*
* -
*
* _category
*
*
* -
*
* _created_at
*
*
* -
*
* _last_updated_at
*
*
* -
*
* _version
*
*
* -
*
* _view_count
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SortingConfiguration withDocumentAttributeKey(String documentAttributeKey) {
setDocumentAttributeKey(documentAttributeKey);
return this;
}
/**
*
* The order that the results should be returned in. In case of ties, the relevance assigned to the result by Amazon
* Kendra is used as the tie-breaker.
*
*
* @param sortOrder
* The order that the results should be returned in. In case of ties, the relevance assigned to the result by
* Amazon Kendra is used as the tie-breaker.
* @see SortOrder
*/
public void setSortOrder(String sortOrder) {
this.sortOrder = sortOrder;
}
/**
*
* The order that the results should be returned in. In case of ties, the relevance assigned to the result by Amazon
* Kendra is used as the tie-breaker.
*
*
* @return The order that the results should be returned in. In case of ties, the relevance assigned to the result
* by Amazon Kendra is used as the tie-breaker.
* @see SortOrder
*/
public String getSortOrder() {
return this.sortOrder;
}
/**
*
* The order that the results should be returned in. In case of ties, the relevance assigned to the result by Amazon
* Kendra is used as the tie-breaker.
*
*
* @param sortOrder
* The order that the results should be returned in. In case of ties, the relevance assigned to the result by
* Amazon Kendra is used as the tie-breaker.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SortOrder
*/
public SortingConfiguration withSortOrder(String sortOrder) {
setSortOrder(sortOrder);
return this;
}
/**
*
* The order that the results should be returned in. In case of ties, the relevance assigned to the result by Amazon
* Kendra is used as the tie-breaker.
*
*
* @param sortOrder
* The order that the results should be returned in. In case of ties, the relevance assigned to the result by
* Amazon Kendra is used as the tie-breaker.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SortOrder
*/
public SortingConfiguration withSortOrder(SortOrder sortOrder) {
this.sortOrder = sortOrder.toString();
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 (getDocumentAttributeKey() != null)
sb.append("DocumentAttributeKey: ").append(getDocumentAttributeKey()).append(",");
if (getSortOrder() != null)
sb.append("SortOrder: ").append(getSortOrder());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof SortingConfiguration == false)
return false;
SortingConfiguration other = (SortingConfiguration) obj;
if (other.getDocumentAttributeKey() == null ^ this.getDocumentAttributeKey() == null)
return false;
if (other.getDocumentAttributeKey() != null && other.getDocumentAttributeKey().equals(this.getDocumentAttributeKey()) == false)
return false;
if (other.getSortOrder() == null ^ this.getSortOrder() == null)
return false;
if (other.getSortOrder() != null && other.getSortOrder().equals(this.getSortOrder()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDocumentAttributeKey() == null) ? 0 : getDocumentAttributeKey().hashCode());
hashCode = prime * hashCode + ((getSortOrder() == null) ? 0 : getSortOrder().hashCode());
return hashCode;
}
@Override
public SortingConfiguration clone() {
try {
return (SortingConfiguration) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.kendra.model.transform.SortingConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}