You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Michael Wechner <mi...@wyona.com> on 2007/11/28 00:42:11 UTC

Full text search/queries

Hi

I am using the xml and html extractors for 
jcr:content(nt:resource)/@jcr:data
and it all seems to work very fine.

Unfortunately the searching doesn't seem to work somehow.
When using

Query q = qm.createQuery("//jcr:content[jcr:data]", Query.XPATH);

then I will find some nodes, but when using

Query q = qm.createQuery("//jcr:content[jcr:contains(@jcr:data, 
'Hello')]", Query.XPATH);

then I don't receive any nodes, whereas I am very sure there are nodes 
containing the word "Hello" and also the index, because when doing a 
grep I do receive

jackrabbit/workspaces/default/db/log/log1.dat
jackrabbit/workspaces/default/db/seg0/c3e0.dat
jackrabbit/workspaces/default/blobs/69/ba/8cda67744342894dd91ae6581b2c/%7bhttp%3a%2f%2fwww.jcp.org%2fjcr%2f1.0%7ddata.0.bin
jackrabbit/workspaces/default/index/_c/_2.cfs

after spending quite some time on figuring out what might be wrong, I 
wanted to ask if somebody on this mailing list has any pointers what I 
might be doing wrong.

Thanks

Michael

-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org
+41 44 272 91 61


Re: Full text search/queries

Posted by Michael Wechner <mi...@wyona.com>.
Marcel Reutegger wrote:

> Michael Wechner wrote:
>
>> Query q = qm.createQuery("//jcr:content[jcr:contains(@jcr:data, 
>> 'Hello')]", Query.XPATH);
>>
>> then I don't receive any nodes, whereas I am very sure there are 
>> nodes containing the word "Hello" and also the index, because when 
>> doing a grep I do receive
>
>
> the binary property jcr:data is indexed but is only available on the 
> node level index. see spec section 6.6.5.2.


ok, thanks for the pointer

> jcr:contains on a property is supported in jackrabbit but only on 
> string properties.
>
> the following query will work:
>
> //jcr:content[jcr:contains(., 'hello')]
>
> or alternatively:
>
> //*[jcr:contains(jcr:content, 'hello')]


that works indeed. Thanks very much.

I think now I am ready to create a Wiki page ;-)

Cheers

Michael

>
>
> regards
>  marcel



-- 
Michael Wechner
Wyona      -   Open Source Content Management - Yanel, Yulup
http://www.wyona.com
michael.wechner@wyona.com, michi@apache.org
+41 44 272 91 61


Re: Full text search/queries

Posted by Marcel Reutegger <ma...@gmx.net>.
Michael Wechner wrote:
> Query q = qm.createQuery("//jcr:content[jcr:contains(@jcr:data, 
> 'Hello')]", Query.XPATH);
> 
> then I don't receive any nodes, whereas I am very sure there are nodes 
> containing the word "Hello" and also the index, because when doing a 
> grep I do receive

the binary property jcr:data is indexed but is only available on the node level 
index. see spec section 6.6.5.2. jcr:contains on a property is supported in 
jackrabbit but only on string properties.

the following query will work:

//jcr:content[jcr:contains(., 'hello')]

or alternatively:

//*[jcr:contains(jcr:content, 'hello')]


regards
  marcel

RE: Full text search/queries

Posted by Ard Schrijvers <a....@hippo.nl>.
> In case you are interested in the source
> 
> https://svn.wyona.com/repos/public/yarep/trunk
> 
> U: anonymous
> P: anonymous
> 
> or you might also download it via Maven
> 
> http://maven2.wyona.org/yarep/
> 
> whereas the latest JCR implemenation is not available via 
> Maven yet, but hopefully tonight

Thanks for the info,

Regards Ard

> 
> Cheers
> 
> Michael
> 
> >Regards Ard
> >
> > 

Re: Full text search/queries

Posted by Michael Wechner <mi...@wyona.com>.
Ard Schrijvers wrote:

>>after spending quite some time on figuring out what might be 
>>wrong, I wanted to ask if somebody on this mailing list has 
>>any pointers what I might be doing wrong.
>>    
>>
>
>let me know wether you have any results. 
>  
>

Marcel's hint helped to fix it

>Furthermore out of curiosity: are you using jackrabbit in combination
>with Lenya/Cocoon? 
>  
>

no. Some time ago I have started a (my ;-) minimal content repository 
API, basically something like

Repository.getNode("/foo/bar.txt").getInputStream();
Repository.getNode("/foo/bar.txt").getOutputStream();
Node[] nodes = Repository.search("hello");

without all the "overhead", whereas don't get me wrong, I think JCR is 
great, but for "smaller" applications I am bit overwhelmed with JCR.

But anyway I finally found the time to implement JCR beneath the API 
above :-)

In case you are interested in the source

https://svn.wyona.com/repos/public/yarep/trunk

U: anonymous
P: anonymous

or you might also download it via Maven

http://maven2.wyona.org/yarep/

whereas the latest JCR implemenation is not available via Maven yet, but 
hopefully tonight

Cheers

Michael

>Regards Ard
>
>  
>
>>Thanks
>>
>>Michael
>>
>>--
>>Michael Wechner
>>Wyona      -   Open Source Content Management   -    Apache Lenya
>>http://www.wyona.com                      http://lenya.apache.org
>>michael.wechner@wyona.com                        michi@apache.org
>>+41 44 272 91 61
>>
>>    
>>
>
>  
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management - Yanel, Yulup
http://www.wyona.com
michael.wechner@wyona.com, michi@apache.org
+41 44 272 91 61


RE: Full text search/queries

Posted by Ard Schrijvers <a....@hippo.nl>.
Hello Michael,

> Michael Wechner wrote: 
> Query q = qm.createQuery("//jcr:content[jcr:data]", Query.XPATH);

I think you meant here @jcr:data, richt (but assuming you did test with
@jcr:data, this is not the problem)

> 
> then I will find some nodes, but when using
> 
> Query q = qm.createQuery("//jcr:content[jcr:contains(@jcr:data,
> 'Hello')]", Query.XPATH);

This does look entirely correct...what happens with other words? Can you
find any? Try one lowercase (I know, it should not matter, but I just do
not know what might be wrong)

If above does not work, can you add an xml doc containing one unique
word of letters only, like 'abcdefghijk'. Test if you can find this one.


> 
> after spending quite some time on figuring out what might be 
> wrong, I wanted to ask if somebody on this mailing list has 
> any pointers what I might be doing wrong.

let me know wether you have any results. 

Furthermore out of curiosity: are you using jackrabbit in combination
with Lenya/Cocoon? 

Regards Ard

> 
> Thanks
> 
> Michael
> 
> --
> Michael Wechner
> Wyona      -   Open Source Content Management   -    Apache Lenya
> http://www.wyona.com                      http://lenya.apache.org
> michael.wechner@wyona.com                        michi@apache.org
> +41 44 272 91 61
> 
>