[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [OASIS Issue Tracker] Commented: (CMIS-660) Clarification needed onthe use of quotes in a CONTAINS() query to search on phrases
[ http://tools.oasis-open.org/issues/browse/CMIS-660?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19676#action_19676 ] Florent Guillaume commented on CMIS-660: ---------------------------------------- I find it quite dangerous grammar-wise to remove the quotes around a <text search expression>, as it would mix the SQL-level grammar and the fulltext grammar into one. I think it's much more modular to see the fulltext expression as a simple string from the SQL level, and see CONTAINS mostly as a function call (from the grammar point of view), with optional qualifier. Inside the (decoded of SQL-level escapes) text search expression, we have a simple grammar with words and phrases. I agree that it could simplify things a bit if we'd used <double quote> instead of <quote> for phrase delimiter, but the 1.0 spec uses <quote> and we can work with that. Regarding escaping: - SQL says that <quote> is escaped as <quote><quote> inside SQL <character string literal>, - 2.1.10.3 says that <backslash> is also allowed for escaping inside quoted strings, i.e., inside <character string literal>, - then 2.1.10.2.4.3 explains that if we want a quote to be part of a word, then it has to be backslash-escaped What we should clarify in the BNF (and what was my intent all along when writing this stuff) is that the BNF for <text search expression>, described after !! This is full-text search criteria. is really the BFN for the text search expression WITH SQL-LEVEL ESCAPING REMOVED, so that the two grammars are not mixed. To summarize with the current spec, if we want to search on the word: that's first word escaping turns it into: that\'s and character string literal escaping turns it into either: 'that\\\'s' or: 'that\\''s' because there are two ways of escaping <quote>: either <backslash><quote> (CMIS), or <quote><quote> (SQL). So you'd have a query with: ... AND CONTAINS('that\\\'s') If you want to search on the full phrase: that's me the phrase escaping turns it into: 'that\'s me' and character string literal escaping turns it into for instance: '\'that\\\'s me\'' (with other variants depending on how you choose to escape <quote>) So the query is: ... AND CONTAINS('\'that\\\'s me\'') > Clarification needed on the use of quotes in a CONTAINS() query to search on phrases > ------------------------------------------------------------------------------------ > > Key: CMIS-660 > URL: http://tools.oasis-open.org/issues/browse/CMIS-660 > Project: OASIS Content Management Interoperability Services (CMIS) TC > Issue Type: Improvement > Components: Domain Model > Affects Versions: Draft 0.70 > Reporter: Jane Doong > Assignee: Ethan Gur-esh > Priority: Minor > > Clarification needed on the use of quotes in a CONTAINS() query to search on phrases. > Spec: > 2575 BNF grammar structure:: CONTAINS ( [ <qualifier> ,] ' <text search expression> ' ) > 2413 <phrase> ::= <quote> <word> [ {<space> <word>} ... ] <quote> > 2422 <quote> ::= "'" !! Single-quote only, consistent with SQL-92 string literal > 2597 Within a word or phrase, each (single-)quote must also be escaped by a preceding backslash "\" > The spec specifically states that <quote> is single-quote only. > My questions is on specifying a phrase inside the CONTAINS(). > Since the entire text search expression is enclosed in single quotes, > I question whether a phrase should again be enclosed in single quotes, or should it be in double-quotes. > According to spec: > Word search: CONTAINS('house') > Phrase search : CONTAINS(' 'my house' ') > Should phrases be in double-quotes? ==> CONTAINS(' "my house" ') -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tools.oasis-open.org/issues/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]