cancel
Showing results for 
Search instead for 
Did you mean: 

Property values list

mangar
Star Contributor
Star Contributor
Here at work, employees can put files in alfresco, and they are cleverly tagged with their employee ID as a property in their "employee document" content type. All real simple. Now I can get a list of docs by employee through lucene, but what I want is a list of ID's
when I do this:

+@cq\\:empID:\ *  I get a list of all docs with an empID, not what I need. I just need a list of empID's

Would this be better off as a CMIS query?  What would this look like?

Thank you
1 REPLY 1

mangar
Star Contributor
Star Contributor
The dirty solution is:

          
               String queryString = "+@cq\\:empID:*";
          Query query = new Query(Constants.QUERY_LANG_LUCENE, queryString );
           QueryResult queryResult = repositoryService.query(storeRef, query, false);
           ResultSet resultSet = queryResult.getResultSet();
           Set<String> set = new HashSet<String>();
          
           ResultSetRow[] it = resultSet.getRows();
           for(int y=0;y<it.length;y++) {
              NamedValue[] nc = it[y].getColumns();
              for(int x=0;x<nc.length;x++) {
                 if(nc[x].getName().endsWith("empID")) {
                    set.add(nc[x].getValue());
                 }
              }
           }

which gets me a set of all my employee ids, the downside is obvious, as I have to loop through ALL documents with an ID.

Is there a better way?