コード例 #1
0
 /**
  * @param filteredDocument Document with field values extracted for selected fields.
  * @return More Like This query for the passed document.
  */
 public Query like(Map<String, Collection<Object>> filteredDocument) throws IOException {
   if (fieldNames == null) {
     // gather list of valid fields from lucene
     Collection<String> fields = MultiFields.getIndexedFields(ir);
     fieldNames = fields.toArray(new String[fields.size()]);
   }
   return createQuery(retrieveTerms(filteredDocument));
 }
コード例 #2
0
  /**
   * Return a query that will return docs like the passed lucene document ID.
   *
   * @param docNum the documentID of the lucene doc to generate the 'More Like This" query for.
   * @return a query that will return docs like the passed lucene document ID.
   */
  public Query like(int docNum) throws IOException {
    if (fieldNames == null) {
      // gather list of valid fields from lucene
      Collection<String> fields = MultiFields.getIndexedFields(ir);
      fieldNames = fields.toArray(new String[fields.size()]);
    }

    return createQuery(retrieveTerms(docNum));
  }
コード例 #3
0
ファイル: DocLengthStore.java プロジェクト: YueGuBUPT/test
 /** @param reader IndexReader object created in {@link QryEval}. */
 public DocLengthStore(IndexReader reader) throws IOException {
   this.reader = reader;
   for (String field : MultiFields.getIndexedFields(reader)) {
     this.values.put(field, MultiDocValues.getNormValues(reader, field));
   }
 }