[MarkLogic Dev General] search:parse parenthetical grouping

Will Thompson wthompson at jonesmcclure.com
Fri Aug 10 16:15:03 PDT 2012


I need to prevent paren grouping from happening when the parens are part of a string - typically it's a reference-type number. I can't think of a situation where this would be desirable anyway:

search:parse('123.4(5)')
 => cts:and-query((cts:word-query("123.4(5"), cts:word-query(")")))

If I change the grammar to require a space on either or both sides of the paren, then it will always break some legitimate grouping case like "(hello AND world)".

Is there any way to control these grammar options a little further? It would be easy if you could just use regexes in the grammar options, i.e.:

<starter strength="30" apply="grouping" delimiter="(^|\s)/)">/(($|\s)</starter>

Thanks,

Will



More information about the General mailing list