cancel
Showing results for 
Search instead for 
Did you mean: 

Search querys problems [SOLVED]

rhakaro
Champ in-the-making
Champ in-the-making
Hi all again!

I have a new problem developing a query search in my Java code.

I´m seeking some contents in alfresco, but it returns to me empty, only with the "Path" property fill.

I´m doing this:

                ………….
                ………….

                Query query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:\"/app:company_home/cm:my_folder//*\" + @cm\\:name:plantilla*");
         
           // Execute the query
           final Store STORE = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
           QueryResult queryResult = repositoryService.query(STORE, query, false);
          
           // Display the results
           ResultSet results = queryResult.getResultSet();
           ResultSetRow[] rows = results.getRows();
          
           System.out.println("La busqueda da algo asi:");
           if(rows != null){
              for(ResultSetRow row : rows){
                                      for (NamedValue namedValue : row.getColumns()){
                                             if (namedValue.getName().endsWith("path") == true)
                                                        System.out.println(namedValue.getValue());
                                              if (namedValue.getName().endsWith(Constants.PROP_CREATED) == true)
                                                        System.out.println(namedValue.getValue());
                                              else if (namedValue.getName().endsWith(Constants.PROP_NAME) == true){
                                                        System.out.println(namedValue.getValue());
                                             else if (namedValue.getName().endsWith(Constants.PROP_DESCRIPTION) == true){
                                                        System.out.println(namedValue.getValue());
                                              
                                               ………….
                                               ………….
                                               ………….
}

The only result that doesn´t null is the "path" property.

What could be happen??

Thak you very much!
16 REPLIES 16

rhakaro
Champ in-the-making
Champ in-the-making
That´s true, I did`t realize about that detail. I don´t know where is the diference, but I will work on to resolve it!

maqsood
Confirmed Champ
Confirmed Champ
Even i don't know, I just try in the other way round and it works. me also working around it to find out which one to use and when.

dcastro2716
Champ in-the-making
Champ in-the-making
Somebody know if this is going to be like this from now on?? or is something with 3.2r2? because some books say that query is the rigth way to go, but it doesnt work to get all the properties anymore. We should use only get in the future?
thx.

dA.

openpj
Elite Collaborator
Elite Collaborator
In Alfresco 3.2 Enterprise if you try to get results from the query method of the Repository Service, Alfresco will return only nodes with the following fields: uuid, types and aspects.
The columns field contains only the path of the node, but it should contain all the properties (as the previous versions of Alfresco).

The queryParents and queryChildren methods correctly return all the properties as expected.
It could be a bug or is this a wanted feature of Alfresco 3.2?

relax
Champ in-the-making
Champ in-the-making
Hello,
I also have a problem for a search query problem. I want to search a group for some operation as rename display name.
public static void renameGroup2(String groupName, String newName) {
         String query = "+PATH:\"/sys:system/sys:authorities//*\" + @usr\\:authorityName:\""
               + groupName + "\"";
         RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory
               .getRepositoryService();
         try {
            Node[] nodes = repositoryService.get(new Predicate(null, new Store(
                  "user", "alfrescoUserStore"), new Query(
                  Constants.QUERY_LANG_LUCENE, query)));
// but nodes is null!!!
            CMLUpdate update = new CMLUpdate(new NamedValue[] {Utils.createNamedValue("{http://www.alfresco.org/model/user/1.0}authorityName", newName)},
                  new Predicate(new Reference[] { nodes[0].getReference() },
                        null, null), null);
but nodes is null.
I tested query with:
+PATH:"/sys:system/sys:authorities//*" + @usr\:authorityName:"GROUP_test"
or
+PATH:"/sys:system/sys:authorities//*" + @usr\:authorityName:"test"

where rootgroup name is test.

I suppose have a problem in query. In Alfresco Node Browser
http://localhost:8080/alfresco/faces/jsp/admin/node-browser.jsp
I select
user://alfrescoUserStore
for
lucene search
what's the search text to search a rootgroup with name test?

Thank you

relax
Champ in-the-making
Champ in-the-making
Hello,
this is XPath for a Group named test

/{http://www.alfresco.org/model/system/1.0}system/{http://www.alfresco.org/model/system/1.0}authoritie...

present in store
workspace://SpacesStore

maschlosser
Champ in-the-making
Champ in-the-making
Hi Folks,

I'm a little confuse here. After all what is the wright to go? get or query?

tks
MS
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.