Data types
The previous examples show how string values can be added. Mindbreeze InApp automatically finds figures in such properties. You can, for example, set the property version to 12 and Mindbreeze interprets the value. You can then e.g. search for version: 12 TO 24. This function also enables the use of version with the value “Version 12”. The restriction expression can still remain the same.
Figures can also be specified as a numerical value. This allows the section search to be accelerated and you receive a numerical value if you use the SearchService. With the following example you can index entire figures:
indexable.putProperty(NamedValue.newBuilder() .setName("version") .addValue( Value.newBuilder() .setKind(Value.Kind.INTEGER) .setIntegerValue(12) ) );
So that the quantity values can be searched through, the attribute regexmatchable
must be set to true
in the CategoryDescriptor.
<metadatum id="version" regexmatchable="true"> <name>Version</name> </metadatum>
The search is possible with version:[12] or version:[10 TO 20].
In addition to simple numerical values, date values are also possible:
indexable.putProperty(NamedValue.newBuilder() .setName("mydate") .addValue( Value.newBuilder() .setKind(Value.Kind.QUANTITY) .setQuantityValue(Quantity.newBuilder() .setKind(Quantity.Kind.TIME) .setUnit(Unit.MS_SINCE_01_01_1970_00_00) .setIntValue(Indexable.getCalendarFromDate(new Date()).getTime().getTime()) ) ) );
The search mydate:[2003-01-01 TO 2023-01-01] restricts the results to between 2003 und 2023.
The search documentsize limits the size of the searched document:
indexable.putProperty(NamedValue.newBuilder() .setName("availablespace") .addValue( Value.newBuilder() .setKind(Value.Kind.QUANTITY) .setQuantityValue(Quantity.newBuilder() .setKind(Quantity.Kind.INFORMATION_STORAGE) .setUnit(Unit.BYTE) .setIntValue(1024 * 1024) ) ) );