You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Rencana Tarigan <re...@yahoo.co.id> on 2010/06/21 14:24:15 UTC

Search Query

Hi, can someone give me example for query using xpath or sql in jackrabbit..
for example i want get a result that the content contains "text" and 
path like %text% so the result will :
result1.txt <-- this file contains "text"
atext.doc
texta.doc
atexta.doc

Thanks...

-- 
-----=====*=====-----
Rencana Tarigan
+6285270567856
YM   : rencana_tarigan
Skype: rencana.tarigan
http://cana.web.id


Re: Search Query

Posted by Alexander Klimetschek <ak...@day.com>.
On Wed, Jun 30, 2010 at 13:43, David Gough <ba...@googlemail.com> wrote:
> Hi Rencana,
>
> Try
>
> //element(*, nt:file)[jcr:contains(jcr:
>>
>> path, '//"searchText"')]
>>
>
> or failing that:
>
> //element(*, nt:file)[jcr:like(jcr:
>>
>> path, '//"*searchText*"')]
>>

That doesn't work, there is no "jcr:path" for the execution of an
xpath query. This is only a pseudo-property for JCR-SQL (1.0) and when
reading out values from a Row.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Search Query

Posted by Rencana Tarigan <re...@yahoo.co.id>.
How to make it work for sub folder too ?

On 6/30/2010 6:43 PM, David Gough wrote:
> Hi Rencana,
>
> Try
>
> //element(*, nt:file)[jcr:contains(jcr:
>    
>> path, '//"searchText"')]
>>
>>      
> or failing that:
>
> //element(*, nt:file)[jcr:like(jcr:
>    
>> path, '//"*searchText*"')]
>>
>>      
> regards
>
> Dave
>
>
>
> On Mon, Jun 21, 2010 at 4:41 PM, Rencana Tarigan<
> rencana_tarigan@yahoo.co.id>  wrote:
>
>    
>> I have path /cana.txt but when i use this query the result is empty..
>> //element(*, nt:file)[jcr:contains(jcr:path, '//"+searchText+"')]
>> can somebody tell me what is wrong with this query ?
>>
>>
>> On 6/21/2010 8:15 PM, Justin Edelson wrote:
>>
>>      
>>> http://wiki.gxdeveloperweb.com/confluence/display/GXDEV/XPath+JCR+Sample+Queries
>>>
>>> has some good sample xpath queries.
>>>
>>> Justin
>>>
>>> On Jun 21, 2010, at 8:24 AM, Rencana Tarigan wrote:
>>>
>>>
>>>
>>>        
>>>> Hi, can someone give me example for query using xpath or sql in
>>>> jackrabbit..
>>>> for example i want get a result that the content contains "text" and path
>>>> like %text% so the result will :
>>>> result1.txt<-- this file contains "text"
>>>> atext.doc
>>>> texta.doc
>>>> atexta.doc
>>>>
>>>> Thanks...
>>>>
>>>> --
>>>> -----=====*=====-----
>>>> Rencana Tarigan
>>>> +6285270567856
>>>> YM   : rencana_tarigan
>>>> Skype: rencana.tarigan
>>>> http://cana.web.id
>>>>
>>>>
>>>>
>>>>          
>>>
>>>
>>>
>>>        
>>      
>    

Re: Search Query

Posted by David Gough <ba...@googlemail.com>.
Hi Rencana,

Try

//element(*, nt:file)[jcr:contains(jcr:
>
> path, '//"searchText"')]
>

or failing that:

//element(*, nt:file)[jcr:like(jcr:
>
> path, '//"*searchText*"')]
>

regards

Dave



On Mon, Jun 21, 2010 at 4:41 PM, Rencana Tarigan <
rencana_tarigan@yahoo.co.id> wrote:

> I have path /cana.txt but when i use this query the result is empty..
> //element(*, nt:file)[jcr:contains(jcr:path, '//"+searchText+"')]
> can somebody tell me what is wrong with this query ?
>
>
> On 6/21/2010 8:15 PM, Justin Edelson wrote:
>
>>
>> http://wiki.gxdeveloperweb.com/confluence/display/GXDEV/XPath+JCR+Sample+Queries
>>
>> has some good sample xpath queries.
>>
>> Justin
>>
>> On Jun 21, 2010, at 8:24 AM, Rencana Tarigan wrote:
>>
>>
>>
>>> Hi, can someone give me example for query using xpath or sql in
>>> jackrabbit..
>>> for example i want get a result that the content contains "text" and path
>>> like %text% so the result will :
>>> result1.txt<-- this file contains "text"
>>> atext.doc
>>> texta.doc
>>> atexta.doc
>>>
>>> Thanks...
>>>
>>> --
>>> -----=====*=====-----
>>> Rencana Tarigan
>>> +6285270567856
>>> YM   : rencana_tarigan
>>> Skype: rencana.tarigan
>>> http://cana.web.id
>>>
>>>
>>>
>>
>>
>>
>>
>

Re: Search Query

Posted by Rencana Tarigan <re...@yahoo.co.id>.
I have path /cana.txt but when i use this query the result is empty..
//element(*, nt:file)[jcr:contains(jcr:path, '//"+searchText+"')]
can somebody tell me what is wrong with this query ?

On 6/21/2010 8:15 PM, Justin Edelson wrote:
> http://wiki.gxdeveloperweb.com/confluence/display/GXDEV/XPath+JCR+Sample+Queries
>
> has some good sample xpath queries.
>
> Justin
>
> On Jun 21, 2010, at 8:24 AM, Rencana Tarigan wrote:
>
>    
>> Hi, can someone give me example for query using xpath or sql in jackrabbit..
>> for example i want get a result that the content contains "text" and path like %text% so the result will :
>> result1.txt<-- this file contains "text"
>> atext.doc
>> texta.doc
>> atexta.doc
>>
>> Thanks...
>>
>> -- 
>> -----=====*=====-----
>> Rencana Tarigan
>> +6285270567856
>> YM   : rencana_tarigan
>> Skype: rencana.tarigan
>> http://cana.web.id
>>
>>      
>
>
>    

Re: Search Query

Posted by Justin Edelson <ju...@justinedelson.com>.
http://wiki.gxdeveloperweb.com/confluence/display/GXDEV/XPath+JCR+Sample+Queries

has some good sample xpath queries.

Justin

On Jun 21, 2010, at 8:24 AM, Rencana Tarigan wrote:

> Hi, can someone give me example for query using xpath or sql in jackrabbit..
> for example i want get a result that the content contains "text" and path like %text% so the result will :
> result1.txt <-- this file contains "text"
> atext.doc
> texta.doc
> atexta.doc
> 
> Thanks...
> 
> -- 
> -----=====*=====-----
> Rencana Tarigan
> +6285270567856
> YM   : rencana_tarigan
> Skype: rencana.tarigan
> http://cana.web.id
> 


Re: Search Query

Posted by Alexander Klimetschek <ak...@day.com>.
On Mon, Jun 21, 2010 at 14:24, Rencana Tarigan
<re...@yahoo.co.id> wrote:
> Hi, can someone give me example for query using xpath or sql in jackrabbit..
> for example i want get a result that the content contains "text" and path
> like %text% so the result will :
> result1.txt <-- this file contains "text"
> atext.doc
> texta.doc
> atexta.doc

You can't do explicit wildcard searches on node (file) names with JCR
xpath or SQL from the jcr 1.0 spec. But afaik, normally the full text
for aggregated node types (depends on the indexing config) such as
nt:file will include its name, thus a full text search with the node
scope '.' should find both:

//element(*, nt:file)[jcr:contains(., 'text')]

Wildcard ode name searches are possible with JCR-SQL2 (since
Jackrabbit / JCR 2.0):

SELECT * FROM [nt:file] WHERE LOCALNAME() LIKE '%text%'

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com