Search content in specific folder

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2010 08:57 AM
I have folders in Alfresco laid out as:
Company Home|
……………….|
……………….|Client Name|
……………………………..|
……………………………..|Accounting
……………………………..|Sales
……………………………..|Human Resources
I'm trying to put together a webscript that will search for documents only in the 'Human Resources' folder.
var query = "PATH:\"/app:company_home/cm:Client_Name/cm:Human_Resources//*\"+TEXT:searchString";var results = search.luceneSearch(query);
Where am I going wrong and can you point me to some documentation on setting PATH for luceneSearch?
Any help appreciated … I'm at a loss.
Thanks.
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2010 09:15 AM
var query = "PATH:\"/app:company_home"+"/cm:"+search.ISO9075Encode("Client Name")+"/cm:"+search.ISO9075Encode("Human Resources")+"//*\" +TEXT:\"searchString\" ";
You can find this reference here:http://wiki.alfresco.com/wiki/3.2_JavaScript_API#Search_API
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2010 10:16 AM
I appreciate you taking the time to give such a thorough solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2010 10:53 AM
I've found that the lucene search is searching within the 'Data Dictionary'. My web scripts are in
Company Home / Data Dictionary / Web Script Extensions / com / mycompany
During testing, I hard coded the search string. To my surprise, in the results returned from the search was my javascript file.
Why is it searching outside the specified path? … and how can I stop it from searching outside the specified path?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2010 11:03 AM
Thanks,
Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2010 11:53 AM
/ Company Home / Client Name / Human Resources
var query = "+PATH:\"/app:company_home"+"/cm:"+search.ISO9075Encode("Client Name")+"/cm:"+search.ISO9075Encode("Human Resources")+"//*\" +TEXT:\"searchString\" ";
I'm using Community Edition 3.3.
Any help very much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2010 02:32 AM
From the node browser you have to check the content property in the properties section.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2010 09:44 AM
What I want to do is search only files the folder '/Company Home/Fall and Associates/Creditors/TT900/' for the string "in other baskets".
In the folder '/Company Home/Fall and Associates/Creditors/TT900/' are two files.
One is a copy of the other. They both contain the string "in other baskets" – they both should match this search. I've added no other files to the repository.
I should find both files – but I don't. In addition, despite the '+PATH:' I am getting the script itself returned as a result (it's under '…/Data Dictionary /Web Script Extensions/…')
var query = "+PATH:\"/app:company_home"+"/cm:"+search.ISO9075Encode("Fall And Associates") + "/cm:"+search.ISO9075Encode("Creditors")+"/cm:"+search.ISO9075Encode("TT900") +"//*\" +TEXT:\"in other baskets\" ";var results = search.luceneSearch(query);
This is the result
<items>
−
<item>
<name>Duplicate2 of Kiva.pdf</name>
<title>
number 2
</title>
<size> 94,176 </size>
<author>billmc</author>
</item>
−
<item>
<name>searchDocs.get.js</name>
<title>
</title>
<size> 1,708 </size>
<author>admin</author>
</item>
</items>
The 'searchDocs.get.js' is the name of the script (based on the Packt Book by Shariff in company). It should NOT be returned.
Missing is the expected 'Duplicate1 of Kiva.pdf' which is identitical (a copy) of the file returned.
Questions:
1) Is this lucene search syntax correct for what I'm trying to do?
2) Why do I keep getting matches from outside the PATH setting? How can I stop that?
3) Why do both results get returned (along with Alfresco system files of various kinds) when I do the search from the webclient … but only one is returned in the webscript?
4) Is there another way, besides lucene to do this?
I should add that this is on Community Edition 3.3 which we're using to evaluate Alfresco's suitability in our company. Search is obviously a huge factor in our evaluation.
Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2010 10:51 AM
This doesn't return all the files .. and it seems to drop files now and then as I change the contents of the folder.
var query = "+PATH:\"/app:company_home"+"/cm:"+search.ISO9075Encode("Fall And Associates") + "/cm:"+search.ISO9075Encode("Creditors")+"/cm:"+search.ISO9075Encode("TT900") +"//*\"";var results = search.luceneSearch(query);
I have 3 copies of the same file in this folder … it only returns two of them.
I think I've got something somewhere eating the first result?
What's going on?
What would be the simplest way for me to see the result as far as a ftl file goes?
TIA.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2010 11:55 AM
My html.ftl file returns the correct output.
Thanks for the patience.
