Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
lucene_facet.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2019 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 /*
17  * lucene_facet.h
18  *
19  * Created on: 31 Oct 2019
20  * Author: billy
21  */
22 
23 #ifndef CORE_SERVER_LUCENE_INCLUDE_LUCENE_FACET_H_
24 #define CORE_SERVER_LUCENE_INCLUDE_LUCENE_FACET_H_
25 
26 #include "jansson.h"
27 
28 #include "lucene_library.h"
29 #include "typedefs.h"
30 #include "schema_keys.h"
31 #include "linked_list.h"
32 
33 
34 typedef struct LuceneFacet
35 {
36  char *lf_name_s;
37  uint32 lf_count;
38 } LuceneFacet;
39 
40 
41 typedef struct LuceneFacetNode
42 {
46 
47 
48 
49 
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
51 
52 #ifdef ALLOCATE_LUCENE_FACET_CONSTANTS
53  #define LUCENE_FACET_PREFIX GRASSROOTS_LUCENE_API
54  #define LUCENE_FACET_VAL(x) = x
55  #define LUCENE_CONCAT_VAL(x,y) = x y
56 #else
57  #ifdef LINUX
58  #define LUCENE_FACET_PREFIX extern //GRASSROOTS_SERVICE_API
59  #elif defined MAC
60  #define LUCENE_FACET_PREFIX extern //GRASSROOTS_SERVICE_API
61  #elif defined WINDOWS
62  #define LUCENE_FACET_PREFIX GRASSROOTS_SERVICE_API
63  #endif
64 
65  #define LUCENE_FACET_VAL(x)
66  #define LUCENE_CONCAT_VAL(x,y)
67 #endif
68 
69 #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
70 
71 
72 
73 
74 LUCENE_FACET_PREFIX const char *LF_NAME_S LUCENE_CONCAT_VAL (CONTEXT_PREFIX_SCHEMA_ORG_S, "name");
75 
76 LUCENE_FACET_PREFIX const char *LF_COUNT_S LUCENE_FACET_VAL ("count");
77 
78 
79 #ifdef __cplusplus
80 extern "C"
81 {
82 #endif
83 
84 
85 
86 
87 
94 GRASSROOTS_LUCENE_API LuceneFacet *AllocateLuceneFacet (const char *name_s, const uint32 count);
95 
96 
104 
105 
106 
114 
115 
116 
123 GRASSROOTS_LUCENE_API LuceneFacetNode *AllocateLuceneFacetNodeByParts (const char *name_s, const uint32 count);
124 
125 
133 
134 
143 
144 
145 
154 
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 
161 #endif /* CORE_SERVER_LUCENE_INCLUDE_LUCENE_FACET_H_ */
LuceneFacet::FreeLuceneFacet
GRASSROOTS_LUCENE_API void FreeLuceneFacet(LuceneFacet *facet_p)
Free a LuceneFacet.
GRASSROOTS_LUCENE_API
#define GRASSROOTS_LUCENE_API
Definition: lucene_library.h:46
LuceneFacet::lf_count
uint32 lf_count
Definition: lucene_facet.h:37
schema_keys.h
The keys for the Grassroots Schema.
LuceneFacetNode
Definition: lucene_facet.h:41
CONTEXT_PREFIX_SCHEMA_ORG_S
#define CONTEXT_PREFIX_SCHEMA_ORG_S
Definition: schema_keys.h:103
typedefs.h
LUCENE_FACET_VAL
const LUCENE_FACET_PREFIX char *LF_COUNT_S LUCENE_FACET_VAL("count")
LuceneFacet::AllocateLuceneFacet
GRASSROOTS_LUCENE_API LuceneFacet * AllocateLuceneFacet(const char *name_s, const uint32 count)
Allocate a LuceneFacet to store search result metadata.
LuceneFacet
Definition: lucene_facet.h:34
LuceneFacetNode::lfn_facet_p
LuceneFacet * lfn_facet_p
Definition: lucene_facet.h:44
LuceneFacet::FreeLuceneFacetNode
GRASSROOTS_LUCENE_API void FreeLuceneFacetNode(ListItem *node_p)
Free a LuceneFacetNode.
LuceneFacetNode::lfn_node
ListItem lfn_node
Definition: lucene_facet.h:43
linked_list.h
A doubly-linked list.
LuceneFacet::lf_name_s
char * lf_name_s
Definition: lucene_facet.h:36
LuceneFacet::GetLuceneFacetAsJSON
GRASSROOTS_LUCENE_API json_t * GetLuceneFacetAsJSON(const LuceneFacet *facet_p)
Get the JSON representation of a LuceneFacet.
LuceneFacet::GetLuceneFacetFromResultsJSON
GRASSROOTS_LUCENE_API LuceneFacet * GetLuceneFacetFromResultsJSON(const json_t *json_p)
Get a LuceneFacet from a JSON representation.
LuceneFacet::AllocateLuceneFacetNode
GRASSROOTS_LUCENE_API LuceneFacetNode * AllocateLuceneFacetNode(LuceneFacet *facet_p)
Allocate a LuceneFacetNode.
LuceneFacet::AllocateLuceneFacetNodeByParts
GRASSROOTS_LUCENE_API LuceneFacetNode * AllocateLuceneFacetNodeByParts(const char *name_s, const uint32 count)
Allocate a LuceneFacetNode.
LUCENE_CONCAT_VAL
const LUCENE_FACET_PREFIX char *LF_NAME_S LUCENE_CONCAT_VAL(CONTEXT_PREFIX_SCHEMA_ORG_S, "name")
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43
lucene_library.h