Package org.terrier.matching

Examples of org.terrier.matching.Matching


      if (rq.getControl("c_set").equals("true"))
      {
        wmodel.setParameter(Double.parseDouble(rq.getControl("c")));
      }
     
      Matching matching = getMatchingModel(rq);
     
      if (logger.isDebugEnabled()){
        logger.debug("weighting model: " + wmodel.getInfo());
      }
      MatchingQueryTerms mqt = rq.getMatchingQueryTerms();
      mqt.setDefaultTermWeightingModel((WeightingModel)wmodel);
      Query q = rq.getQuery();
     
      /* now propagate fields into requirements, and apply boolean matching
         for the decorated terms. */
      ArrayList<Query> requirement_list = new ArrayList<Query>();
      ArrayList<Query> field_list = new ArrayList<Query>();
     
      q.getTermsOf(RequirementQuery.class, requirement_list, true);
      q.getTermsOf(FieldQuery.class, field_list, true);
                     //  System.out.println(requirement_list);
                      //  System.out.println(field_list);
      for (int i=0; i<field_list.size(); i++)
        if (!requirement_list.contains(field_list.get(i)))
          requirement_list.add(field_list.get(i));
                                           
                       //     System.out.println(requirement_list);
                      //  System.out.println(field_list);
      /*if (logger.isDebugEnabled())
      {
        for (int i=0; i<requirement_list.size(); i++) {
          if(logger.isDebugEnabled()){
          logger.debug("requirement: " + ((RequiredTermModifier)requirement_list.get(i)).getName());
          }
        }
        for (int i=0; i<field_list.size(); i++) {
          if(logger.isDebugEnabled()){
          logger.debug("field: " + ((TermInFieldModifier)field_list.get(i)).getName());
          }
        }
      }*/
   
      if (requirement_list.size()>0) {
        mqt.addDocumentScoreModifier(new BooleanScoreModifier(requirement_list));
      }

      mqt.setQuery(q);
      mqt.normaliseTermWeights();
      try{
        ResultSet outRs = matching.match(rq.getQueryID(), mqt);
        //now crop the collectionresultset down to a query result set.
        rq.setResultSet(outRs.getResultSet(0, outRs.getResultSize()));
      } catch (IOException ioe) {
        logger.error("Problem running Matching, returning empty result set as query"+rq.getQueryID(), ioe);
        rq.setResultSet(new QueryResultSet(0));
View Full Code Here


    * instance to use
    * @return null If an error occurred obtaining the matching class
    */
  protected Matching getMatchingModel(Request rq)
  {
    Matching rtr = null;
    Index _index = rq.getIndex();
    String ModelName = rq.getMatchingModel();
    //add the namespace if the modelname is not fully qualified
   
    final String ModelNames[] = ModelName.split("\\s*,\\s*");
 
View Full Code Here

TOP

Related Classes of org.terrier.matching.Matching

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.