Exemplo n.º 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));
 }
Exemplo n.º 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));
  }
Exemplo n.º 3
0
 /** @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));
   }
 }