I'm trying to query for some files in Alfresco using SearchService; my idea is:
1) get folder's noderef where I want to search in for files
2) then get noderef's path via NodeService
3) finally query Solar via SearchService to find files in that specific path
The problem raises when querying to Solr, I get the following exception:
ERROR [solr.core.SolrCore] [http-bio-8443-exec-1] org.apache.solr.common.SolrException: org.apache.lucene.queryParser.ParseException: **Cannot parse** 'PATH:"/{http\://www.alfresco.org/model/application/1.0}company_home/{http\://www.alfresco.org/model/application/1.0}user_homes/{http\://www.alfresco.org/model/content/1.0}abeecher/{http\://www.alfresco.org/model/content/1.0}nominas//*"': **Failed to parse XPath**...
Unexpected '{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/application/1.0}user_homes/{http://www.alfresco.org/model/content/1.0}abeecher/{http://www.alfresco.org/model/content/1.0}nominas//*'
If I replace the full prefixes by prefixes of type cm: etc... the query works well.
Is there any "Alfresco Way" to do this instead of transforming the string with a regex? Or am I doing something wrong?
Code I'm using is:
Path path3 = nodeService.getPath(folder);
SearchParameters sp = new SearchParameters();
sp.addStore(Repository.getStoreRef());
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery("PATH:\"/{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/application/1.0}user_homes/{http://www.alfresco.org/model/content/1.0}abeecher/{http://www.alfresco.org/model/content/1.0}nominas//*\"");
//sp.setQuery(path3);
//sp.setQuery(path3.toString());
ResultSet results = null;
results = searchService.query(sp);