|
| 1 | +/* |
| 2 | + * DISCLAIMER |
| 3 | + * |
| 4 | + * Copyright 2016 ArangoDB GmbH, Cologne, Germany |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + * you may not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + * |
| 18 | + * Copyright holder is ArangoDB GmbH, Cologne, Germany |
| 19 | + */ |
| 20 | + |
| 21 | + |
| 22 | +package com.arangodb.entity.arangosearch.analyzer; |
| 23 | + |
| 24 | + |
| 25 | +import java.util.Objects; |
| 26 | + |
| 27 | +/** |
| 28 | + * @author Michele Rastelli |
| 29 | + */ |
| 30 | +public class AQLAnalyzerProperties { |
| 31 | + |
| 32 | + private String queryString; |
| 33 | + private Boolean collapsePositions; |
| 34 | + private Boolean keepNull; |
| 35 | + private Integer batchSize; |
| 36 | + private Long memoryLimit; |
| 37 | + |
| 38 | + private ReturnType returnType; |
| 39 | + |
| 40 | + public enum ReturnType { |
| 41 | + string, number, bool |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * @return AQL query to be executed |
| 46 | + */ |
| 47 | + public String getQueryString() { |
| 48 | + return queryString; |
| 49 | + } |
| 50 | + |
| 51 | + public void setQueryString(String queryString) { |
| 52 | + this.queryString = queryString; |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * @return <ul> |
| 57 | + * <li> |
| 58 | + * true: set the position to 0 for all members of the query result array |
| 59 | + * </li> |
| 60 | + * <li> |
| 61 | + * false (default): set the position corresponding to the index of the result array member |
| 62 | + * </li> |
| 63 | + * </ul> |
| 64 | + */ |
| 65 | + public Boolean getCollapsePositions() { |
| 66 | + return collapsePositions; |
| 67 | + } |
| 68 | + |
| 69 | + public void setCollapsePositions(Boolean collapsePositions) { |
| 70 | + this.collapsePositions = collapsePositions; |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * @return <ul> |
| 75 | + * <li> |
| 76 | + * true (default): treat null like an empty string |
| 77 | + * </li> |
| 78 | + * <li> |
| 79 | + * false: discard nulls from View index. Can be used for index filtering (i.e. make your query return null for unwanted data). Note that empty results are always discarded. |
| 80 | + * </li> |
| 81 | + * </ul> |
| 82 | + */ |
| 83 | + public Boolean getKeepNull() { |
| 84 | + return keepNull; |
| 85 | + } |
| 86 | + |
| 87 | + public void setKeepNull(Boolean keepNull) { |
| 88 | + this.keepNull = keepNull; |
| 89 | + } |
| 90 | + |
| 91 | + /** |
| 92 | + * @return number between 1 and 1000 (default = 1) that determines the batch size for reading data from the query. |
| 93 | + * In general, a single token is expected to be returned. However, if the query is expected to return many results, |
| 94 | + * then increasing batchSize trades memory for performance. |
| 95 | + */ |
| 96 | + public Integer getBatchSize() { |
| 97 | + return batchSize; |
| 98 | + } |
| 99 | + |
| 100 | + public void setBatchSize(Integer batchSize) { |
| 101 | + this.batchSize = batchSize; |
| 102 | + } |
| 103 | + |
| 104 | + /** |
| 105 | + * @return memory limit for query execution in bytes. (default is 1048576 = 1Mb) Maximum is 33554432U (32Mb) |
| 106 | + */ |
| 107 | + public Long getMemoryLimit() { |
| 108 | + return memoryLimit; |
| 109 | + } |
| 110 | + |
| 111 | + public void setMemoryLimit(Long memoryLimit) { |
| 112 | + this.memoryLimit = memoryLimit; |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * @return data type of the returned tokens. If the indicated type does not match the actual type then an implicit |
| 117 | + * type conversion is applied. |
| 118 | + */ |
| 119 | + public ReturnType getReturnType() { |
| 120 | + return returnType; |
| 121 | + } |
| 122 | + |
| 123 | + public void setReturnType(ReturnType returnType) { |
| 124 | + this.returnType = returnType; |
| 125 | + } |
| 126 | + |
| 127 | + @Override |
| 128 | + public boolean equals(Object o) { |
| 129 | + if (this == o) return true; |
| 130 | + if (o == null || getClass() != o.getClass()) return false; |
| 131 | + AQLAnalyzerProperties that = (AQLAnalyzerProperties) o; |
| 132 | + return Objects.equals(queryString, that.queryString) && Objects.equals(collapsePositions, that.collapsePositions) && Objects.equals(keepNull, that.keepNull) && Objects.equals(batchSize, that.batchSize) && Objects.equals(memoryLimit, that.memoryLimit) && returnType == that.returnType; |
| 133 | + } |
| 134 | + |
| 135 | + @Override |
| 136 | + public int hashCode() { |
| 137 | + return Objects.hash(queryString, collapsePositions, keepNull, batchSize, memoryLimit, returnType); |
| 138 | + } |
| 139 | + |
| 140 | +} |
0 commit comments