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