AnsweredAssumed Answered

Search against WCM

Question asked by loic on Jul 9, 2009
Latest reply on Jul 28, 2009 by d.segato
Hi !

I have a website which retreive content via AVMRemote etc…
Now, I'd like to search (lucene) content in my Webproject (like with the node browser) through java code.

i've red this > http://wiki.alfresco.com/wiki/WCM_Search and this > http://wiki.alfresco.com/wiki/Search#Example_API_Call but I did not succeeded.

here's my method :
public void searchAVM() {
      
      ServiceRegistry serviceRegistry = null;
      
      StoreRef myWcm = new StoreRef("avm://crhn/-1;www;avm_webapps;ROOT;contenu");
      
        SearchParameters sp = new SearchParameters();
        sp.addStore(myWcm);
        sp.setLanguage(SearchService.LANGUAGE_LUCENE);
        sp.setQuery("TEXT:*a*");
        ResultSet results = null;
        try
        {
            results = serviceRegistry.getSearchService().query(sp);
            for(ResultSetRow row : results)
            {
                NodeRef currentNodeRef = row.getNodeRef();
                System.out.println(currentNodeRef.getId());
            }
        }
        finally
        {
            if(results != null)
            {
                results.close();
            }
        }
       
   }

Anyone to help me finding out where i'm wrong ?

Thanks in advance

Outcomes