Index: main/plugin-odf-web/src/org/ametys/plugins/odfweb/generators/ODFSearch.java
===================================================================
--- main/plugin-odf-web/src/org/ametys/plugins/odfweb/generators/ODFSearch.java	(revision 42071)
+++ main/plugin-odf-web/src/org/ametys/plugins/odfweb/generators/ODFSearch.java	(working copy)
@@ -18,12 +18,13 @@
 import java.io.IOException;
 import java.util.regex.Matcher;
 
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.xml.AttributesImpl;
 import org.apache.cocoon.xml.XMLUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
 import org.apache.lucene.queryParser.MultiFieldQueryParser;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.BooleanClause;
@@ -31,8 +32,16 @@
 import org.apache.lucene.search.Query;
 import org.xml.sax.SAXException;
 
+import org.ametys.cms.FilterNameHelper;
+import org.ametys.cms.contenttype.ContentType;
+import org.ametys.cms.contenttype.MetadataManager;
+import org.ametys.cms.contenttype.MetadataSet;
 import org.ametys.odf.contenttype.SubProgramMetadataIndexer;
+import org.ametys.odf.program.Program;
 import org.ametys.odf.program.ProgramFactory;
+import org.ametys.odf.program.SubProgram;
+import org.ametys.odf.program.SubProgramFactory;
+import org.ametys.plugins.repository.AmetysObject;
 import org.ametys.web.lucene.LuceneConstants;
 
 
@@ -44,6 +53,16 @@
     /** True for subprogram search */
     protected boolean _subprogramsSearch;
     
+    /** The metadata manager */
+    protected MetadataManager _metadataManager;
+    
+    @Override
+    public void service(ServiceManager smanager) throws ServiceException
+    {
+        super.service(smanager);
+        _metadataManager = (MetadataManager) smanager.lookup(MetadataManager.ROLE);
+    }
+    
     @Override
     public void generate() throws IOException, SAXException, ProcessingException
     {
@@ -78,15 +97,40 @@
     @Override
     protected void saxAdditionalInfosOnPageHit(Document doc) throws SAXException
     {
-        Field[] subprograms = doc.getFields("subprograms");
-        for (Field subprogram : subprograms)
+        ContentType contentType = _cTypeExtPt.getExtension(SubProgramFactory.SUBPROGRAM_CONTENT_TYPE);
+        MetadataSet metadataSet = contentType != null ? contentType.getMetadataSetForView("index") : null;
+        
+        String pageId = doc.get("id");
+        String programId  = StringUtils.substringAfter(pageId, "&programId=");
+        if (StringUtils.isNotBlank(programId) && metadataSet !=  null)
         {
-            String value = subprogram.stringValue();
-            
-            AttributesImpl attrs = new AttributesImpl();
-            attrs.addCDATAAttribute("path", value.substring(0, value.indexOf(";")));
-            attrs.addCDATAAttribute("title", value.substring(value.indexOf(";") + 1));
-            XMLUtils.createElement(contentHandler, "subprogram", attrs);
+            Program program = _resolver.resolveById(programId);
+            for (AmetysObject child : program.getChildren())
+            {
+                if (child instanceof SubProgram)
+                {
+                    SubProgram subProgram = (SubProgram) child;
+                    String title = subProgram.getTitle();
+                    String path = FilterNameHelper.filterName(title) + "-" + subProgram.getName();
+                    
+                    AttributesImpl attrs = new AttributesImpl();
+                    attrs.addCDATAAttribute("path", path);
+                    attrs.addCDATAAttribute("title", title);
+                    XMLUtils.startElement(contentHandler, "subprogram", attrs);
+                    
+                    try
+                    {
+                        _metadataManager.saxMetadata(contentHandler, subProgram, metadataSet);
+                    }
+                    catch (Exception e)
+                    {
+                        getLogger().error("An error occurred during saxing subprogram '" + subProgram.getId() + "' metadata", e);
+                    }
+                    
+                    XMLUtils.endElement(contentHandler, "subprogram");
+                    
+                }
+            }
         }
     }
     
