case insetsitive query using Groovy scripting

User 9bb55943c4

23-09-2015 10:56:52

Hi, I need help with my Groovy script for Instant JChem.


I want to make a script to perform a text query. I'd seen tutorials about Groovy scripting and found this method (but...I suppose, this query is case sensitive).


q_org = DFTermsFactory.createFieldOperatorValueExpr(Operators.CONTAINS, fldOrganism, null, organism)


How could I rewrite it to make my query case insensitive. Is it possible?


...maybe you can tell me, where it's written about.


Thank you!


Anastasia.

ChemAxon 320de6f832

29-09-2015 13:34:56

Dear Anastasia,


There is needed to define the third parameter in the function createFieldOperatorValueExpr.


You can see in documentation here, possible vaues for this parameter.


I can see in your code, that you let this parameter with value null.  To define case-sensitivity or case-insensitivity you have to set the third parameter as  Map with "query.option.caseInsensitiveSearch":true.


The code will be then st. like this:


def optionMap = [:]

optionMap.put('query.option.caseInsensitiveSearch', true)

q_org = DFTermsFactory.createFieldOperatorValueExpr(Operators.CONTAINS, fldOrganism, optionMap, organism)

Best Regards


Jaromir