Hi,
I'm using the Java DFS API and I'm having problems with search expressions with trailing whitespaces. In specific, the DFS API class 'com.emc.documentum.fs.datamodel.core.query.SimpleValue' removes them (using the trim() method) - and this causes problems in my specific use case.
Here's my scenario:
There is a property which contains values like '12 Foo', '1200 Bar', '300 Baz'. It's a concatenation of IDs and other info and I can not change the format.
When searching on this property, users only enter the ID and my application searches via DFS using a 'begins with' expression. So when a user searches for ID 12, I would create a StructuredQuery with an expression like "property begins with '12 ' - but DFS trims the whitespace, hence documents with values like '1200 ...', '121...' also match the expression.
Does anyone know of an 'official' way to encode the whitespace to prevent this? Using DQL PassthroughQueries instead of StructuredQueries is not an option for me.
I found two solutions so far which are kind of ugly:
- using Java reflection to set the value of SimpleValue with the trailing space, bypassing the setter
- replacing trailing spaces with ideographic spaces, unicode character 3000, which are not affected by Java trimming (in current versions of Java...) and seem to return correct results from Documentum anyway
Regards,
Florian