Line data Source code
1 : // Copyright (C) 2017 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.index.group; 16 : 17 : import static com.google.gerrit.index.SchemaUtil.schema; 18 : 19 : import com.google.common.collect.ImmutableList; 20 : import com.google.gerrit.entities.InternalGroup; 21 : import com.google.gerrit.index.IndexedField; 22 : import com.google.gerrit.index.Schema; 23 : import com.google.gerrit.index.SchemaDefinitions; 24 : 25 : /** 26 : * Definition of group index versions (schemata). See {@link SchemaDefinitions}. 27 : * 28 : * <p>Upgrades are subject to constraints, see {@code 29 : * com.google.gerrit.index.IndexUpgradeValidator}. 30 : */ 31 : public class GroupSchemaDefinitions extends SchemaDefinitions<InternalGroup> { 32 : @Deprecated 33 153 : static final Schema<InternalGroup> V5 = 34 153 : schema( 35 : /* version= */ 5, 36 153 : ImmutableList.of(), 37 153 : ImmutableList.of( 38 : GroupField.CREATED_ON_FIELD, 39 : GroupField.DESCRIPTION_FIELD, 40 : GroupField.ID_FIELD, 41 : GroupField.IS_VISIBLE_TO_ALL_FIELD, 42 : GroupField.MEMBER_FIELD, 43 : GroupField.NAME_FIELD, 44 : GroupField.NAME_PART_FIELD, 45 : GroupField.OWNER_UUID_FIELD, 46 : GroupField.REF_STATE_FIELD, 47 : GroupField.SUBGROUP_FIELD, 48 : GroupField.UUID_FIELD), 49 153 : ImmutableList.<IndexedField<InternalGroup, ?>.SearchSpec>of( 50 : GroupField.CREATED_ON_SPEC, 51 : GroupField.DESCRIPTION_SPEC, 52 : GroupField.ID_FIELD_SPEC, 53 : GroupField.IS_VISIBLE_TO_ALL_SPEC, 54 : GroupField.MEMBER_SPEC, 55 : GroupField.NAME_SPEC, 56 : GroupField.NAME_PART_SPEC, 57 : GroupField.OWNER_UUID_SPEC, 58 : GroupField.REF_STATE_SPEC, 59 : GroupField.SUBGROUP_SPEC, 60 : GroupField.UUID_FIELD_SPEC)); 61 : 62 : // Bump Lucene version requires reindexing 63 153 : @Deprecated static final Schema<InternalGroup> V6 = schema(V5); 64 : 65 : // Lucene index was changed to add an additional field for sorting. 66 153 : @Deprecated static final Schema<InternalGroup> V7 = schema(V6); 67 : 68 : // New numeric types: use dimensional points using the k-d tree geo-spatial data structure 69 : // to offer fast single- and multi-dimensional numeric range. 70 153 : @Deprecated static final Schema<InternalGroup> V8 = schema(V7); 71 : 72 : // Upgrade Lucene to 7.x requires reindexing. 73 153 : static final Schema<InternalGroup> V9 = schema(V8); 74 : 75 : /** Singleton instance of the schema definitions. This is one per JVM. */ 76 153 : public static final GroupSchemaDefinitions INSTANCE = new GroupSchemaDefinitions(); 77 : 78 : private GroupSchemaDefinitions() { 79 153 : super("groups", InternalGroup.class); 80 153 : } 81 : }