Пример #1
0
        public static IEnumerable <Fieldable> Generate(double?lat, double?lng)
        {
            Shape shape = RavenSpatialContext.MakePoint(lng ?? 0, lat ?? 0);

            return(strategy.CreateFields(fieldInfo, shape, true, false).Where(f => f != null)
                   .Concat(new[] { new Field(Constants.SpatialShapeFieldName, RavenSpatialContext.ToString(shape), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS), }));
        }
Пример #2
0
        public static void AddPoint(IndexWriter writer, string name, double lng, double lat)
        {
            Shape shape = context.MakePoint(lng, lat);
            var   doc   = new Document();

            foreach (var fld in strategy.CreateFields(fieldInfo, shape, true, false).Where(f => f != null))
            {
                doc.Add(fld);
            }
            doc.Add(new Field("Name", name, Field.Store.YES,
                              Field.Index.NOT_ANALYZED_NO_NORMS));
            writer.AddDocument(doc);
        }