AnsweredAssumed Answered

Java Search Service not returning all results

Question asked by jcamorgan on Aug 28, 2009
We've created a new content type model called "Asset". When running an advanced search in Alfresco, I can define the Content Type as Asset in the combo box in the advanced search screen. This returns the expected results.

When running the same search in a Java Webscript however, none of the types "Asset" are returned. The search query is obtained from the same saved search I used to search in alfresco. I have checked the syntax and it is exactly the same in Java as in Alfresco. If I create a search to return normal content, it works fine. The type Asset is also returned when I search for normal content, but not when I run the search in the Webscript.

To call the query I used the following:

                      
String query=getQuery(savedSearchNode);

SearchParameters sp = new SearchParameters();
sp.addStore(Repository.getStoreRef());
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery(query);
         
ResultSet resnodes=serviceRegistry.getSearchService().query(sp);

The query string got from the saved search looks like this:
( PATH:"/app:company_home/cm:Managed_x0020_Content/cm:Processes/cm:LEGTM//*" ) AND (( TYPE:"{http://www.sap.com/alfresco.extension.com.sap.ca.legtm}asset"  AND (@\{http\://www.alfresco.org/model/content/1.0\}name:'*"  TEXT:"*")) ( TYPE:"{http://www.alfresco.org/model/content/1.0}folder"  AND (@\{http\://www.alfresco.org/model/content/1.0\}name:'*" )))

Replacing single backslashes with double ones only leads to a parsing error.

Any ideas would be gratefully received!

Thanks,
Craig

Outcomes