1 // Copyright (C) 2019 Google LLC
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 #include "icing/index/term-property-id.h"
16 
17 namespace icing {
18 namespace lib {
19 namespace {
20 
21 enum TermPropertyId {
22   // Property id for whether the term has hits in prefix sections
23   kHasHitsInPrefixSection = 0,
24 
25   // Property id for whether the term has no exact hits. No exact hits means
26   // that the term is for prefix matching only. This kind of term is used only
27   // in main index.
28   kHasNoExactHits = 1,
29 
30   // The smallest property id for namespace. One namespace id will be mapped
31   // to one property id, so that all the property ids that are greater than
32   // this will all be property ids for namespaces.
33   kNamespace = 2,
34 };
35 
36 }  // namespace
37 
GetHasHitsInPrefixSectionPropertyId()38 uint32_t GetHasHitsInPrefixSectionPropertyId() {
39   return kHasHitsInPrefixSection;
40 }
41 
GetHasNoExactHitsPropertyId()42 uint32_t GetHasNoExactHitsPropertyId() { return kHasNoExactHits; }
43 
GetNamespacePropertyId(NamespaceId namespace_id)44 uint32_t GetNamespacePropertyId(NamespaceId namespace_id) {
45   return kNamespace + namespace_id;
46 }
47 
48 }  // namespace lib
49 }  // namespace icing
50