public abstract CreateIndexableFields ( IShape shape ) : Lucene.Net.Documents.Field[] | ||
shape | IShape | |
return | Lucene.Net.Documents.Field[] |
protected virtual List <Document> getDocuments(IEnumerator <SpatialTestData> sampleData) { List <Document> documents = new List <Document>(); while (sampleData.MoveNext()) { SpatialTestData data = sampleData.Current; Document document = new Document(); document.Add(new StringField("id", data.id, Field.Store.YES)); document.Add(new StringField("name", data.name, Field.Store.YES)); IShape shape = data.shape; shape = convertShapeFromGetDocuments(shape); if (shape != null) { foreach (Field f in strategy.CreateIndexableFields(shape)) { document.Add(f); } if (storeShape)//just for diagnostics { document.Add(new StoredField(strategy.FieldName, shape.toString())); } } documents.Add(document); } return(documents); }
private Document NewSampleDocument(int id, params IShape[] shapes) { Document doc = new Document(); doc.Add(new Int32Field("id", id, Field.Store.YES)); //Potentially more than one shape in this field is supported by some // strategies; see the javadocs of the SpatialStrategy impl to see. foreach (IShape shape in shapes) { foreach (IIndexableField f in strategy.CreateIndexableFields(shape)) { doc.Add(f); } //store it too; the format is up to you // (assume point in this example) IPoint pt = (IPoint)shape; doc.Add(new StoredField(strategy.FieldName, pt.X.ToString(CultureInfo.InvariantCulture) + " " + pt.Y.ToString(CultureInfo.InvariantCulture))); } return(doc); }