FireBoard
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Search by Folder (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Search by Folder
#1374
Dena (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
Re:Search by Folder 1 Year, 3 Months ago Karma: 0  
Thanks I will have a look
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1377
Dena (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
Re:Search by Folder 1 Year, 3 Months ago Karma: 0  
Hi there,

I have the following code which is supposed to search folder "denzil" which is a subfolder of the root folder (okm:root) for doc's that have keywords "document". However the search returns 0 records, when infact it should return 1 record. I would appreciate it if someone could assist me.

Best Regards
Dena

String username = "denzil";
String searchText = "document";

String search = "/jcr:root/okm:root/"+userName+"//element(*,okm:document)[jcr:contains(@okm:keywords,'"+ searchText + "')] order by @jcrcore descending";
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/11/17 21:10 By Dena.
  The administrator has disabled public write access.
#1385
pavila (Admin)
Admin
Posts: 564
graphgraph
User Offline Click here to see the profile of this user
Gender: Male OpenKM
Re:Search by Folder 1 Year, 3 Months ago Karma: 9  
I have make a test and works fine. Which version of OpenKM are you running?
 
Report to moderator   Logged Logged  
 
Be open, my friend!
  The administrator has disabled public write access.
#1386
Dena (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
Re:Search by Folder 1 Year, 3 Months ago Karma: 0  
Thanks I managed to sort out the problem, I added the following "[1]" to the query string. I read the JCR specification, they give great examples explaining the use of XPath for JCR.

String username = "denzil";
String searchText = "document";

String search = "/jcr:root/okm:root/"+userName+"[1]//element(*,okm:document)[jcr:contains(@okm:keywords,'"+ searchText + "')] order by @jcrcore descending";
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1391
pavila (Admin)
Admin
Posts: 564
graphgraph
User Offline Click here to see the profile of this user
Gender: Male OpenKM
Re:Search by Folder 1 Year, 3 Months ago Karma: 9  
I don't understand why you have to add this "[1]" ¿?
 
Report to moderator   Logged Logged  
 
Be open, my friend!
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop