1. jummp
  2. jummp

Commits

Raza Ali  committed ee62062

Delegate model-format specific indexing to relevant services

  • Participants
  • Parent commits 601df43
  • Branches master

Comments (0)

Files changed (9)

File grails-app/services/net/biomodels/jummp/core/ModelDelegateService.groovy

View file
     void grantReadAccess(long modelId, User collaborator) {
         modelService.grantReadAccess(Model.get(modelId), User.get(collaborator.id))
     }
+    
+    String getSearchIndexingContent(RevisionTransportCommand revision) {
+    	    modelService.getSearchIndexingContent(revision)
+    }
 
     void grantWriteAccess(long modelId, User collaborator) {
         modelService.grantWriteAccess(Model.get(modelId), User.get(collaborator.id))

File grails-app/services/net/biomodels/jummp/core/ModelFileFormatService.groovy

View file
         return service ? service.getFormatVersion(revision) : ""
     }
 
+    
+    String getSearchIndexingContent(RevisionTransportCommand revision) {
+    	FileFormatService service = serviceForFormat(revision?.format)
+        return service ? service.getSearchIndexingContent(revision) : ""
+    }
+    
     /**
      * Retrieves all annotation URNs through the service responsible for the format used
      * by the @p revision.

File grails-app/services/net/biomodels/jummp/core/ModelService.groovy

View file
         return revision
     }
 
+    /**
+    * Uses the modelfileformatservice to get content to be used for indexing a model
+    *
+    * Passes the @p revision to the modelfileformatservice, gets content to be used for indexing the model
+    * @param revision The model revision
+    * @return The model content
+    **/
+    public String getSearchIndexingContent(RevisionTransportCommand revision) {
+    	    return modelFileFormatService.getSearchIndexingContent(revision)
+    }
     
     
     /**

File jummp-plugins/jummp-plugin-combine-archive/grails-app/services/net/biomodels/jummp/plugins/omex/OmexService.groovy

View file
     public String getFormatVersion(RevisionTransportCommand revision) {
         return revision ? "0.1" : ""
     }
+    
+    @Profiled(tag="omexService.getSearchIndexingContent")
+    public String getSearchIndexingContent(RevisionTransportCommand revision) {
+    	    return ""
+    }
 
     /*
      * Helper method that checks if a file appears to be a valid COMBINE archive.

File jummp-plugins/jummp-plugin-core-api/grails-app/services/net/biomodels/jummp/core/model/UnknownFormatService.groovy

View file
         } 
         return false
     }
+    
+    public String getSearchIndexingContent(RevisionTransportCommand revision) {
+    	    return ""
+    }
 }
 

File jummp-plugins/jummp-plugin-core-api/src/java/net/biomodels/jummp/core/model/FileFormatService.java

View file
      * @return the textual representation of the format's version - e.g. L3V2 for SBML.
      */
     public String getFormatVersion(RevisionTransportCommand revision);
+    
+    /**
+     * Retrieves content associated with a particular @p revision of a model
+     * @param revision the Revision of a model
+     * @return the textual representation of the format indexing content
+     */
+    public String getSearchIndexingContent(RevisionTransportCommand revision);
 }

File jummp-plugins/jummp-plugin-pharmml/grails-app/services/net/biomodels/jummp/plugins/pharmml/PharmMlService.groovy

View file
 
         return theName.toString()
     }
+    
+    @Profiled(tag="pharmMlService.getSearchIndexingContent")
+    public String getSearchIndexingContent(RevisionTransportCommand revision) {
+    	    return ""
+    }
 
     @Profiled(tag="pharmMlService.extractDescription")
     public String extractDescription(final List<File> model) {

File jummp-plugins/jummp-plugin-sbml/grails-app/services/net/biomodels/jummp/plugins/sbml/SbmlService.groovy

View file
             return notesString
         }
     }
+    
+    @Profiled(tag="SbmlService.getSearchIndexingContent")
+    public String getSearchIndexingContent(RevisionTransportCommand revision) {
+    	    return ""
+    }
 
     @Profiled(tag="SbmlService.getAnnotations")
     public List<Map> getAnnotations(RevisionTransportCommand revision) {

File src/groovy/net/biomodels/jummp/search/UpdatedRepositoryListener.groovy

View file
 		
 		String name = revision.name
 		String description = revision.description
-
+		String content=modelDelegateService.getSearchIndexingContent(revision)
 
 		Field nameField =
 			new Field("name",name,Field.Store.YES,Field.Index.NOT_ANALYZED);
 		Field descriptionField = 
 			new Field("description",description,Field.Store.NO,Field.Index.ANALYZED); 
+		Field contentField = 
+			new Field("content",content,Field.Store.NO,Field.Index.ANALYZED); 
 		Field idField = 
-			new Field("id",""+revision.id,Field.Store.YES,Field.Index.NO); 
+			new Field("model_id",""+revision.model.id,Field.Store.YES,Field.Index.NO); 
+		Field versionField = 
+			new Field("versionNumber",""+revision.revisionNumber,Field.Store.YES,Field.Index.NO);
+		
 
 		Document doc = new Document();
 		// Add these fields to a Lucene Document
 		doc.add(idField);
+		doc.add(versionField);
 		doc.add(nameField);
 		doc.add(descriptionField);
+		doc.add(contentField)
 
 		//Step 3: Add this document to Lucene Index.
 		indexWriter.addDocument(doc);