Hi,

Yes, only single quotes are used around the text search expression,
like for any string literal. The latest version of the spec has had
errata, and now says more clearly:

<quote> <text search expression> <quote>
<quote> ::= "’" !! Single-quote only, consistent with SQL-92 string literal

See: http://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.html

Florent


On Thu, Jun 6, 2013 at 7:55 PM, Ian Ashley <[email protected]> wrote:
> Dear all,
>
> I am implementing the free text searching (CONTAINS) in our repository.
>
> From the BNF in the spec it looks like phrases are enclosed in double quotes, 
> e.g.
>
> SELECT cmis:objectId FROM cmis:document WHERE CONTAINS('"Hello World"')
>
> In practice this doesn't seem to be the case and phrases are wrapped in \'. 
> e.g.
>
> SELECT cmis:objectId FROM cmis:document WHERE CONTAINS('\'Hello World\'')
>
> This is certainly how the grammar in OpenCMIS works because to get a Node 
> with type TextSearchLexer.TEXT_SEARCH_PHRASE_STRING_LIT I need to wrap the 
> phrase in \'. Is the spec wrong or have I mis-intpreted something.
>
> The relevant bits from the spec are;
>
>  <text search predicate> ::= CONTAINS "(" [ <qualifier> "," ] <quote> <text 
> search expression> <quote> ")"
> <text search expression> ::= <conjunct> [ {<space> OR <space> <conjunct>} … ]
> <conjunct> ::= <term> [ {<space> <term>} ... ]
> <term> ::= ['-'] <simple term>
> <simple term> ::= <word> | <phrase>
> <word> ::= <word element> {<word element>}
> <phrase> ::= <double quote> <word> {<space> <word>} <double quote>
> <quote symbol> ::= <quote><quote> | <backslash><quote>
> <word element> ::= <char> - <space char> - <backslash char> - <quote> - 
> <double quote> | <quote symbol>
> <space> ::= <space char> [ {<space char>} ... ]
> <space char> ::= ' '
> <backslash char> ::= <backslash><backslash>
> <char> ::= !! Any character
> <quote> ::= "'" !! Single-quote only, consistent with SQL-92 string literal 
> <double quote> ::= " !! U+0022
> <backslash> ::= \ !! U+005C
>
> The Alfresco site 
> (http://wiki.alfresco.com/wiki/CMIS_Query_Language#text_search_predicate) 
> shows \' around phrases.
>
> Regards,
> Ian
>



--
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

Reply via email to