Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.
Level 1
Level 2
Melden Sie sich an, um alle Badges zu sehen
Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.
Hi All,
CONTAINS(s.[jcr:title],'abc') OR (s.[jcr:title] LIKE 'abc%'))
The above line is being used in JCR-SQL2 query.
1]What exactly does CONTAINS and LIKE do here.
Any thoughts on this will be helpful.
Gelöst! Gehe zu Lösung.
Zugriffe
Antworten
Likes gesamt
Please see below.
SELECT * FROM [nt:base] AS s WHERE CONTAINS(s.title, 'client')
SELECT * FROM [nt:base] AS s WHERE s.title like '%client%'
SELECT * FROM [nt:file] WHERE NAME() LIKE '%.png'
SELECT * FROM [nt:file] WHERE NAME() LIKE 'abc%'
Hope this clears difference between LIKE and COONTAINS
Zugriffe
Antworten
Likes gesamt
Please refer below link
https://docs.jboss.org/jbossdna/0.7/manuals/reference/html/jcr-query-and-search.html
-Kishore
Zugriffe
Antworten
Likes gesamt
Hi Kishore,
I did go through that, but was not very clear.
Any example/thought on it would be helpful.
Zugriffe
Antworten
Likes gesamt
one basic difference between these is 'Contains' will search for the given string anywhere in the content, however 'LIKE' will search for the given expression, ex: abc% where it searches for the string abc to be the starting of the content and not in the middle.
Zugriffe
Antworten
Likes gesamt
Please see below.
SELECT * FROM [nt:base] AS s WHERE CONTAINS(s.title, 'client')
SELECT * FROM [nt:base] AS s WHERE s.title like '%client%'
SELECT * FROM [nt:file] WHERE NAME() LIKE '%.png'
SELECT * FROM [nt:file] WHERE NAME() LIKE 'abc%'
Hope this clears difference between LIKE and COONTAINS
Zugriffe
Antworten
Likes gesamt
Hi Kishore,
Thanks a lot for your reply.
So, as per my understanding, from the above post , the below two queries will perform the same functionality of finding nodes with title property, which contains "client" anywhere in the text phrase?
SELECT * FROM [nt:base] AS s WHERE CONTAINS(s.title, 'client')
SELECT * FROM [nt:base] AS s WHERE s.title like '%client%'
Zugriffe
Antworten
Likes gesamt
Yes.
Zugriffe
Antworten
Likes gesamt
Adding to answer what lokesh has mentioned, so that in future this answer would act as better solution,
one basic difference between these is 'Contains' will search for the given string anywhere in the content, however 'LIKE' will search for the given expression, ex: abc% where it searches for the string abc to be the starting of the content and not in the middle.
//Expressions could used in Like, whereas contains would only search exact string starting [not end or in between].
Zugriffe
Antworten
Likes gesamt
Hi Kautuk/Lokesh/Kishore,
Thank you for all your help here.
Zugriffe
Antworten
Likes gesamt