Пример #1
0
 @Override
 /**
  * This implementation assumes that we are aborting all documents not yet flushed, as opposed to
  * needing to track specifically which documents have been added by this specific
  * DocConsumerPerThread. This appears to be consistent with lucene's expectations as of version
  * 3.3 but unfortunately I don't see any documentation on the interface's abort method that
  * specifies this as the desired behavior
  */
 void abort() {
   defaultDocConsumerPerThread.abort();
   geoIndexer.abort();
 }
Пример #2
0
  @Override
  DocWriter processDocument() throws IOException {
    // this is where we process the geo-search components of the document
    Document doc = docState.doc;
    int docID = docState.docID;

    List<Fieldable> fields = doc.getFields();
    List<GeoCoordinateField> geoFields = new Vector<GeoCoordinateField>();

    for (Fieldable field : fields) {
      if (field instanceof GeoCoordinateField) {
        geoFields.add((GeoCoordinateField) field);
      }
    }

    for (GeoCoordinateField geoField : geoFields) {
      // process field into GeoIndex here
      geoIndexer.index(docID, geoField);

      doc.removeFields(geoField.name());
    }

    return defaultDocConsumerPerThread.processDocument();
  }