40
40
41
41
public class LuceneIndexConfig {
42
42
43
- private final static String N_INLINE = "inline" ;
44
- private final static String N_IGNORE = "ignore" ;
45
-
46
43
private final static String IGNORE_ELEMENT = "ignore" ;
47
44
private final static String INLINE_ELEMENT = "inline" ;
48
45
private final static String MATCH_ATTR_ELEMENT = "match-attribute" ;
@@ -65,7 +62,9 @@ public class LuceneIndexConfig {
65
62
66
63
private boolean isQNameIndex = false ;
67
64
68
- private Map <QName , String > specialNodes = null ;
65
+ private Set <QName > inlineNodes = null ;
66
+
67
+ private Set <QName > ignoreNodes = null ;
69
68
70
69
private List <AbstractFieldConfig > facetsAndFields = new ArrayList <>();
71
70
@@ -144,21 +143,21 @@ private void parse(LuceneConfig parent, Element root, Map<String, String> namesp
144
143
if (StringUtils .isEmpty (qnameAttr )) {
145
144
throw new DatabaseConfigurationException ("Lucene configuration element 'ignore' needs an attribute 'qname'" );
146
145
}
147
- if (specialNodes == null ) {
148
- specialNodes = new TreeMap <>();
146
+ if (ignoreNodes == null ) {
147
+ ignoreNodes = new HashSet <>(8 );
149
148
}
150
- specialNodes . put (parseQName (qnameAttr , namespaces ), N_IGNORE );
149
+ ignoreNodes . add (parseQName (qnameAttr , namespaces ));
151
150
break ;
152
151
}
153
152
case INLINE_ELEMENT : {
154
- String qnameAttr = configElement .getAttribute (QNAME_ATTR );
153
+ String qnameAttr = configElement .getAttribute (QNAME_ATTR );
155
154
if (StringUtils .isEmpty (qnameAttr )) {
156
155
throw new DatabaseConfigurationException ("Lucene configuration element 'inline' needs an attribute 'qname'" );
157
156
}
158
- if (specialNodes == null ) {
159
- specialNodes = new TreeMap <>();
157
+ if (inlineNodes == null ) {
158
+ inlineNodes = new HashSet <>(8 );
160
159
}
161
- specialNodes . put (parseQName (qnameAttr , namespaces ), N_INLINE );
160
+ inlineNodes . add (parseQName (qnameAttr , namespaces ));
162
161
break ;
163
162
}
164
163
case MATCH_SIBLING_ATTR_ELEMENT :
@@ -312,12 +311,12 @@ public boolean isNamed() {
312
311
return name != null ;
313
312
}
314
313
315
- public boolean isIgnoredNode (QName qname ) {
316
- return specialNodes != null && specialNodes . get (qname ) == N_IGNORE ;
314
+ public boolean isIgnoredNode (final QName qname ) {
315
+ return ignoreNodes != null && ignoreNodes . contains (qname );
317
316
}
318
317
319
- public boolean isInlineNode (QName qname ) {
320
- return specialNodes != null && specialNodes . get (qname ) == N_INLINE ;
318
+ public boolean isInlineNode (final QName qname ) {
319
+ return inlineNodes != null && inlineNodes . contains (qname );
321
320
}
322
321
323
322
public List <AbstractFieldConfig > getFacetsAndFields () {
0 commit comments