Lucene.Net.Spatial.SpatialStrategy.CreateIndexableFields C# (CSharp) Method

CreateIndexableFields() public abstract method

Returns the IndexableField(s) from the shape that are to be added to the Document. These fields are expected to be marked as indexed and not stored.

Note: If you want to store the shape as a string for retrieval in search results, you could add it like this: document.Add(new StoredField(fieldName, ctx.ToString(shape))); The particular string representation used doesn't matter to the Strategy since it doesn't use it.

if given a shape incompatible with the strategy
public abstract CreateIndexableFields ( IShape shape ) : Lucene.Net.Documents.Field[]
shape IShape
return Lucene.Net.Documents.Field[]
        public abstract Field[] CreateIndexableFields(IShape shape);

Usage Example

        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);
        }
All Usage Examples Of Lucene.Net.Spatial.SpatialStrategy::CreateIndexableFields