Пример #1
0
        public override void Query(Org.Neo4j.Storageengine.Api.schema.IndexProgressor_NodeValueClient cursor, IndexOrder indexOrder, bool needsValues, params IndexQuery[] predicates)
        {
            // Spatial does not support providing values
            if (needsValues)
            {
                throw new System.InvalidOperationException("Spatial index does not support providing values");
            }

            if (predicates.Length != 1)
            {
                throw new System.ArgumentException("Only single property spatial indexes are supported.");
            }
            IndexQuery predicate = predicates[0];

            if (predicate is IndexQuery.ExistsPredicate)
            {
                LoadAll();
                BridgingIndexProgressor multiProgressor = new BridgingIndexProgressor(cursor, _descriptor.schema().PropertyIds);
                cursor.Initialize(_descriptor, multiProgressor, predicates, indexOrder, false);
                foreach (NativeIndexReader <SpatialIndexKey, NativeIndexValue> reader in this)
                {
                    reader.Query(multiProgressor, indexOrder, false, predicates);
                }
            }
            else
            {
                if (ValidPredicate(predicate))
                {
                    CoordinateReferenceSystem crs;
                    if (predicate is IndexQuery.ExactPredicate)
                    {
                        crs = (( PointValue )((IndexQuery.ExactPredicate)predicate).value()).CoordinateReferenceSystem;
                    }
                    else if (predicate is IndexQuery.GeometryRangePredicate)
                    {
                        crs = ((IndexQuery.GeometryRangePredicate)predicate).crs();
                    }
                    else
                    {
                        throw new System.ArgumentException("Wrong type of predicate, couldn't get CoordinateReferenceSystem");
                    }
                    SpatialIndexPartReader <NativeIndexValue> part = UncheckedSelect(crs);
                    if (part != null)
                    {
                        part.Query(cursor, indexOrder, false, predicates);
                    }
                    else
                    {
                        cursor.Initialize(_descriptor, IndexProgressor.EMPTY, predicates, indexOrder, false);
                    }
                }
                else
                {
                    cursor.Initialize(_descriptor, IndexProgressor.EMPTY, predicates, indexOrder, false);
                }
            }
        }
Пример #2
0
 public NativeDistinctValuesProgressorAnonymousInnerClass(SpatialIndexPartReader <VALUE> outerInstance, RawCursor <Hit <SpatialIndexKey, VALUE>, IOException> seeker, Org.Neo4j.Storageengine.Api.schema.IndexProgressor_NodeValueClient client, UnknownType openSeekers, UnknownType layout, IComparer <SpatialIndexKey> comparator, NodePropertyAccessor propertyAccessor) : base(seeker, client, openSeekers, layout, comparator)
 {
     this.outerInstance     = outerInstance;
     this._propertyAccessor = propertyAccessor;
 }