C# 클래스 Lucene.Net.Spatial.SpatialStrategy

The SpatialStrategy encapsulates an approach to indexing and searching based on shapes. Different implementations will support different features. A strategy should document these common elements: Can it index more than one shape per field? What types of shapes can be indexed? What types of query shapes can be used? What types of query operations are supported? This might vary per shape. Does it use the FieldCache, or some other type of cache? When? If a strategy only supports certain shapes at index or query time, then in general it will throw an exception if given an incompatible one. It will not be coerced into compatibility. Note that a SpatialStrategy is not involved with the Lucene stored field values of shapes, which is immaterial to indexing and search. Thread-safe. @lucene.experimental
파일 보기 프로젝트 열기: apache/lucenenet 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
ctx Spatial4n.Core.Context.SpatialContext

공개 메소드들

메소드 설명
CreateIndexableFields ( IShape shape ) : Lucene.Net.Documents.Field[]

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.

MakeDistanceValueSource ( IPoint queryPoint ) : ValueSource

See MakeDistanceValueSource(IPoint, double) called with a multiplier of 1.0 (i.e. units of degrees).

MakeDistanceValueSource ( IPoint queryPoint, double multiplier ) : ValueSource

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.

MakeFilter ( SpatialArgs args ) : Filter

Make a Filter based principally on SpatialOperation and IShape from the supplied args. If a subclasses implements MakeQuery(SpatialArgs) then this method could be simply: return new QueryWrapperFilter(MakeQuery(args).Query);

MakeQuery ( SpatialArgs args ) : ConstantScoreQuery

Make a Query based principally on SpatialOperation and IShape from the supplied args. The default implementation is return new ConstantScoreQuery(MakeFilter(args));

MakeRecipDistanceValueSource ( IShape queryShape ) : ValueSource

Returns a ValueSource with values ranging from 1 to 0, depending inversely on the distance from MakeDistanceValueSource(IPoint). The formula is c / (d + c) where 'd' is the distance and 'c' is one tenth the distance to the farthest edge from the center. Thus the scores will be 1 for indexed points at the center of the query shape and as low as ~0.1 at its furthest edges.

ToString ( ) : string

보호된 메소드들

메소드 설명
SpatialStrategy ( SpatialContext ctx, string fieldName ) : Lucene.Net.Documents

Constructs the spatial strategy with its mandatory arguments.

메소드 상세

CreateIndexableFields() 공개 추상적인 메소드

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
리턴 Lucene.Net.Documents.Field[]

MakeDistanceValueSource() 공개 메소드

See MakeDistanceValueSource(IPoint, double) called with a multiplier of 1.0 (i.e. units of degrees).
public MakeDistanceValueSource ( IPoint queryPoint ) : ValueSource
queryPoint IPoint
리턴 ValueSource

MakeDistanceValueSource() 공개 추상적인 메소드

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.
public abstract MakeDistanceValueSource ( IPoint queryPoint, double multiplier ) : ValueSource
queryPoint IPoint
multiplier double
리턴 ValueSource

MakeFilter() 공개 추상적인 메소드

Make a Filter based principally on SpatialOperation and IShape from the supplied args. If a subclasses implements MakeQuery(SpatialArgs) then this method could be simply: return new QueryWrapperFilter(MakeQuery(args).Query);
If the strategy does not support the shape in . If the strategy does not support the in .
public abstract MakeFilter ( SpatialArgs args ) : Filter
args Lucene.Net.Spatial.Queries.SpatialArgs
리턴 Lucene.Net.Search.Filter

MakeQuery() 공개 메소드

Make a Query based principally on SpatialOperation and IShape from the supplied args. The default implementation is return new ConstantScoreQuery(MakeFilter(args));
If the strategy does not support the shape in . If the strategy does not support the in .
public MakeQuery ( SpatialArgs args ) : ConstantScoreQuery
args Lucene.Net.Spatial.Queries.SpatialArgs
리턴 Lucene.Net.Search.ConstantScoreQuery

MakeRecipDistanceValueSource() 공개 메소드

Returns a ValueSource with values ranging from 1 to 0, depending inversely on the distance from MakeDistanceValueSource(IPoint). The formula is c / (d + c) where 'd' is the distance and 'c' is one tenth the distance to the farthest edge from the center. Thus the scores will be 1 for indexed points at the center of the query shape and as low as ~0.1 at its furthest edges.
public MakeRecipDistanceValueSource ( IShape queryShape ) : ValueSource
queryShape IShape
리턴 ValueSource

SpatialStrategy() 보호된 메소드

Constructs the spatial strategy with its mandatory arguments.
protected SpatialStrategy ( SpatialContext ctx, string fieldName ) : Lucene.Net.Documents
ctx Spatial4n.Core.Context.SpatialContext
fieldName string
리턴 Lucene.Net.Documents

ToString() 공개 메소드

public ToString ( ) : string
리턴 string

프로퍼티 상세

ctx 보호되어 있는 프로퍼티

protected SpatialContext,Spatial4n.Core.Context ctx
리턴 Spatial4n.Core.Context.SpatialContext