Skip to content

Commit 51e8b24

Browse files
authored
Merge pull request #100 from olvidalo/range-index-conditions
Range index conditions
2 parents 3bddf80 + 7a6cbce commit 51e8b24

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

data/newrangeindex.xml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,35 @@
246246
<programlisting language="xml">&lt;range>
247247
&lt;create qname="tei:term">
248248
&lt;condition attribute="type" value="main"/>
249-
&lt;field name="mainTerm" type="xs:string/>
249+
&lt;field name="mainTerm" type="xs:string"/>
250250
&lt;/create>
251251
&lt;/range></programlisting>
252252
</example></para>
253253
<para>This will only index the value of the <code>tei:term</code> element if it has an attribute named <code>type</code> with the value <code>"main"</code>. Multiple conditions can be specified in an index definition, in which case all conditions need to match in order for the value to be indexed. <para>In order to take advantage of query optimization for conditionally indexed fields, queries should be formulated like this:<synopsis>//tei:term[@type = "main"][. = "xyz"]</synopsis><para>which then gets rewritten to a call to <synopsis>range:field(("mainTerm"), "eq", "xyz")</synopsis></para></para></para>
254+
<para>By default, condition matching is string-based and case sensitive. The following optional attributes can be specified on a <code>condition</code>: </para>
255+
<variablelist>
256+
<varlistentry>
257+
<term>operator="eq|ne|lt|gt|le|ge|starts-with|ends-with|contains|matches"</term>
258+
<listitem>
259+
<para>Specifies the operator for the comparison. <code>matches</code> supports Java regular expressions.</para>
260+
<para>Default is <code>"eq"</code>.</para>
261+
</listitem>
262+
</varlistentry>
263+
<varlistentry>
264+
<term>case="yes|no"</term>
265+
<listitem>
266+
<para>Turns case sensitivity on or off for string comparisons. </para>
267+
<para>Default is <code>"yes"</code>.</para>
268+
</listitem>
269+
</varlistentry>
270+
<varlistentry>
271+
<term>numeric="yes|no"</term>
272+
<listitem>
273+
<para>Turns numeric comparison on or off for equality and ordinal comparisons (<code>eq, ne, lt, gt, le, ge</code>). When enabled, 01.0 will equal 1 and 2 will be less than 110 for example. The rewriter will respect the type of the value (string, numeric) when matching a condition to a predicate. </para>
274+
<para>Default is <code>"off"</code>.</para>
275+
</listitem>
276+
</varlistentry>
277+
</variablelist>
254278
</section>
255279
</section>
256280
<section>

0 commit comments

Comments
 (0)