Package com.senseidb.search.relevance.RuntimeRelevanceFunction

Examples of com.senseidb.search.relevance.RuntimeRelevanceFunction.RuntimeRelevanceFunctionFactory


        CustomRelevanceFunctionFactory crfFactory = ModelStorage.getPreloadedModel(modelName);
        return crfFactory.build();
      }
      else if (ModelStorage.hasRuntimeModel(modelName))
      {
        RuntimeRelevanceFunctionFactory rrfFactory = ModelStorage.getRuntimeModel(modelName);
        return rrfFactory.build();
      }
      else
      {
        throw new JSONException("No such model (CustomRelevanceFunctionFactory plugin) is registered: " + modelName);
      }
    }
   
    // runtime anonymous model;
    else if (jsonRelevance.has(RelevanceJSONConstants.KW_MODEL))
    {
      JSONObject modelJson  = jsonRelevance.optJSONObject(RelevanceJSONConstants.KW_MODEL);
     
      // build the model factory and one model;
      // if the model factory needs to be saved, the factory will be used, otherwise, just return the model object (RuntimeRelevanceFunction);
      RuntimeRelevanceFunctionFactory rrfFactory = (RuntimeRelevanceFunctionFactory) buildModelFactoryFromModelJSON(modelJson);
      RuntimeRelevanceFunction sm = (RuntimeRelevanceFunction) rrfFactory.build();
     
      //store the model if specified;
      if(modelJson.has(RelevanceJSONConstants.KW_SAVE_AS))
      {
//        "save_as":{
View Full Code Here


    // runtime anonymous model;
    try{
      DataTable _dt = new DataTable();
      CustomMathModel _cModel = CompilationHelper.createCustomMathScorer(modelJson, _dt);
      RuntimeRelevanceFunction sm = new RuntimeRelevanceFunction(_cModel, _dt);
      RuntimeRelevanceFunctionFactory rrfFactory = new RuntimeRelevanceFunctionFactory(sm);
      return rrfFactory;
    }catch(JSONException e)
    {
      if(e instanceof RelevanceException)
      {
View Full Code Here

TOP

Related Classes of com.senseidb.search.relevance.RuntimeRelevanceFunction.RuntimeRelevanceFunctionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.