Beispiel #1
0
  // Sep 12
  public double getScore(RetrievalModel r) throws IOException {

    if (r instanceof RetrievalModelUnrankedBoolean) {
      return this.getScoreUnrankedBoolean(r);
    }
    //    if (r instanceof RetrievalModelRankedBoolean ){
    //    	return this.getScoreRankedBoolean(r);
    //    }
    else {
      throw new IllegalArgumentException(
          r.getClass().getName() + " doesn't support the OR operator.");
    }
  }
  /**
   * Get a score for the document that docIteratorHasMatch matched.
   *
   * @param r The retrieval model that determines how scores are calculated.
   * @return The document score.
   * @throws IOException Error accessing the Lucene index
   */
  public double getScore(RetrievalModel r) throws IOException {

    if (r instanceof RetrievalModelUnrankedBoolean) {
      return this.getScoreUnrankedBoolean(r);
    } else if (r instanceof RetrievalModelRankedBoolean) {
      return this.getScoreRankedBoolean(r);
    } else if (r instanceof RetrievalModelBM25) {
      return this.getScoreBM25((RetrievalModelBM25) r);
    } else if (r instanceof RetrievalModelIndri) {
      return this.getScoreIndri((RetrievalModelIndri) r);
    } else {
      throw new IllegalArgumentException(
          r.getClass().getName() + " doesn't support the SCORE operator.");
    }
  }