1 Reply Latest reply on Aug 20, 2013 12:59 PM by jameswright

    Question on how to search all ForumThreads in the entire community. Jive 6

    jameswright

      In particular I just need to search the subject field for a given string. Here is what I have now, however it always returns an empty collection:

       

        private Iterable<JiveObject> queryCases(String searchString) {

             JiveContext jiveContext = JiveApplication.getContext();

             SearchQueryManager manager = jiveContext.getSearchQueryManager();

             EntityDescriptor entDescriptor = new EntityDescriptor(jiveContext.getCommunityManager().getRootCommunity());

             SearchQueryCriteriaBuilder builder = new SearchQueryCriteriaBuilder(searchString);

             builder.addObjectType(1);

       

             try {

                  builder.setUserID(casePlugin.getDefaultUser().getID());  

             } catch (UserNotFoundException e) {

                  log.error("EB-ERROR: Case search failed. Case Default user not specified.");  

             }

             HashSet<EntityDescriptor> containers = new HashSet<EntityDescriptor>();

             containers.add(entDescriptor);

             builder.setContainers(containers);

       

             SearchResult results = manager.executeQuery(manager.prepareCriteria(builder.build()));

             return results.results();

        }

       

      Is this correct? Any help would be appreciated, I am not finding much documentation on this process.