AnsweredAssumed Answered

ResultSetRow.getValues is null for certain queries?

Question asked by hagak on Jun 13, 2013
Latest reply on Jun 14, 2013 by hagak
Below is a sinppet of code


      StringBuffer sbQuery = new StringBuffer();
      sbQuery.append("TYPE:\"cm:person\"");

      if (!StringUtils.isBlank(filter)) {
         sbQuery.append(" AND ALL:\"" + filter + "*\"");
      }
      SearchService searchService = serviceRegistry.getSearchService();
      
      SearchParameters sp = new SearchParameters();
      sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
      sp.setLanguage(SearchService.LANGUAGE_LUCENE);
      sp.addTextAttribute("@" + ContentModel.PROP_LASTNAME.toString());
      sp.setQuery(sbQuery.toString());
      sp.setMaxItems(100);
      sp.addSort("@" + ContentModel.PROP_LASTNAME.toString(), true);
      sp.addSort("@" + ContentModel.PROP_FIRSTNAME.toString(), true);
      sp.addSort("@" + ContentModel.PROP_USERNAME.toString(), true);
      ResultSet resultsset = null;
      try {
         resultsset = searchService.query(sp);
         // ResultSet resultsset = searchService.query(SSICConstants.STORE,
         // SearchService.LANGUAGE_LUCENE, sbQuery.toString());

         Iterator<ResultSetRow> itr = resultsset.iterator();
         while (itr.hasNext()) {
            ResultSetRow currentRow = itr.next();
            currentRow.getNodeRef() // RETURNS as Expected every time
                                currentRow.getValues() //RETURNS NULL if the above var filter is not null, returns as expect if filter is null
         }
      } finally {
         if (resultsset != null) {
            resultsset.close();
         }
      }


Issue is if the "filter" is empty so that is does not append the "AND ALL:" to the query the getValues returns all of the properties of the node.  However if the filter is set and it still returns the expected nodes, the getValues for those nodes is null.

Other note is if I do the same query without using SearchParameters and just doing it from the query(x,x,x) method the getValues returns as expected.

P.S.  I know I should use parameterized query, still trying to figure out how to set the QName on that.  If anyone has examples of using that would be helpful.

Outcomes