Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class SerializedDVStrategy

    A SpatialStrategy based on serializing a Shape stored into BinaryDocValues. This is not at all fast; it's designed to be used in conjuction with another index based SpatialStrategy that is approximated(like RecursivePrefixTreeStrategy) to add precision or eventually make more specific / advanced calculations on the per-document geometry. The serialization uses Spatial4j's Spatial4n.IO.BinaryCodec.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Inheritance
    object
    SpatialStrategy
    SerializedDVStrategy
    Inherited Members
    SpatialStrategy.m_ctx
    SpatialStrategy.SpatialContext
    SpatialStrategy.FieldName
    SpatialStrategy.MakeDistanceValueSource(IPoint)
    SpatialStrategy.MakeRecipDistanceValueSource(IShape)
    SpatialStrategy.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Spatial.Serialized
    Assembly: Lucene.Net.Spatial.dll
    Syntax
    public class SerializedDVStrategy : SpatialStrategy

    Constructors

    SerializedDVStrategy(SpatialContext, string)

    Constructs the spatial strategy with its mandatory arguments.

    Declaration
    public SerializedDVStrategy(SpatialContext ctx, string fieldName)
    Parameters
    Type Name Description
    SpatialContext ctx
    string fieldName
    Exceptions
    Type Condition
    ArgumentNullException

    ctx or fieldName is null or fieldName is empty.

    Methods

    CreateIndexableFields(IShape)

    Returns the IndexableField(s) from the shape that are to be added to the Lucene.Net.Documents.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.
    Declaration
    public override Field[] CreateIndexableFields(IShape shape)
    Parameters
    Type Name Description
    IShape shape
    Returns
    Type Description
    Field[]

    Not null nor will it have null elements.

    Overrides
    SpatialStrategy.CreateIndexableFields(IShape)
    Exceptions
    Type Condition
    NotSupportedException

    if given a shape incompatible with the strategy

    MakeDistanceValueSource(IPoint, double)

    Make a ValueSource returning the distance between the center of the indexed shape and queryPoint. If there are multiple indexed shapes then the closest one is chosen. The result is multiplied by multiplier, which conveniently is used to get the desired units.

    Declaration
    public override ValueSource MakeDistanceValueSource(IPoint queryPoint, double multiplier)
    Parameters
    Type Name Description
    IPoint queryPoint
    double multiplier
    Returns
    Type Description
    ValueSource
    Overrides
    SpatialStrategy.MakeDistanceValueSource(IPoint, double)

    MakeFilter(SpatialArgs)

    Returns a Lucene.Net.Search.Filter that should be used with Lucene.Net.Search.FilteredQuery.QUERY_FIRST_FILTER_STRATEGY. Use in another manner is likely to result in an NotSupportedException to prevent misuse because the filter can't efficiently work via iteration.

    Declaration
    public override Filter MakeFilter(SpatialArgs args)
    Parameters
    Type Name Description
    SpatialArgs args
    Returns
    Type Description
    Filter
    Overrides
    SpatialStrategy.MakeFilter(SpatialArgs)

    MakeQuery(SpatialArgs)

    Make a Query based principally on SpatialOperation and Spatial4n.Shapes.IShape from the supplied args. The default implementation is

    return new ConstantScoreQuery(MakeFilter(args));
    Declaration
    public override ConstantScoreQuery MakeQuery(SpatialArgs args)
    Parameters
    Type Name Description
    SpatialArgs args
    Returns
    Type Description
    ConstantScoreQuery
    Overrides
    SpatialStrategy.MakeQuery(SpatialArgs)
    Exceptions
    Type Condition
    NotSupportedException

    If the strategy does not support the shape in args.

    UnsupportedSpatialOperationException

    If the strategy does not support the SpatialOperation in args.

    MakeShapeValueSource()

    Provides access to each shape per document as a ValueSource in which ObjectVal(int) returns a Spatial4n.Shapes.IShape.

    Declaration
    public virtual ValueSource MakeShapeValueSource()
    Returns
    Type Description
    ValueSource
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.