jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Gaeremynck <gaeremyn...@gmail.com>
Subject Excerpts on search queries.
Date Fri, 27 Nov 2009 14:30:44 GMT
Hi all,

I am trying to do a basic search query on the entire repository that  
returns any node that has a  sling:resourceType property and that has  
a property/content that matches a search string.
If there is a match I need to get all the properties of that node and  
an excerpt of the matched string.

I have the following xpath query who returns the correct nodes:
//*[@sling:resourceType and (jcr:contains(jcr:content,'*test*') or  

This query gives me the parent of the jcr:content node and all the  
properties on it, which is exactly what I want.

Now, I thought I could get the excerpts out of the results by  
appending /rep:excerpt(.) like so:
//*[@sling:resourceType and (jcr:contains(jcr:content,'*test*') or  

But this doesn't give my a usable excerpt.

I thought a workaround might be to do the first query, and then create  
another query where I OR all the uuid's and do a rep:excerpt in that  
query, but that doesn't produce anything usefull as well.
ex: //*[(@jcr:uuid='ae1..' OR @jcr:uuid='..') and jcr:contains(.,  

I can get a useable excerpt if I do the following query:

I can't use this since this
a) doesn't allow me to search on just nodes who have the  
b) returns all the previously versions of the node.

Should I run my first query above, check if it has a content and then  
manually check if I can get an excerpt out of it?

Another problem I'm facing with excerpts is when I try to get an  
excerpt out of a property/jcr:content with no (or almost none) content  
around the highlighted word/phrase.
It seems to fill up the space by taking other property values of the  

Thanks in advance,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message