Search in sources :

Example 6 with SerializedDVStrategy

use of org.apache.lucene.spatial.serialized.SerializedDVStrategy in project lucene-solr by apache.

the class QueryEqualsHashCodeTest method testEqualsHashCode.

@Test
public void testEqualsHashCode() {
    switch(//0-3
    random().nextInt(4)) {
        case 0:
            predicate = SpatialOperation.Contains;
            break;
        case 1:
            predicate = SpatialOperation.IsWithin;
            break;
        default:
            predicate = SpatialOperation.Intersects;
            break;
    }
    final SpatialPrefixTree gridQuad = new QuadPrefixTree(ctx, 10);
    final SpatialPrefixTree gridGeohash = new GeohashPrefixTree(ctx, 10);
    Collection<SpatialStrategy> strategies = new ArrayList<>();
    RecursivePrefixTreeStrategy recursive_geohash = new RecursivePrefixTreeStrategy(gridGeohash, "recursive_geohash");
    strategies.add(recursive_geohash);
    strategies.add(new TermQueryPrefixTreeStrategy(gridQuad, "termquery_quad"));
    strategies.add(PointVectorStrategy.newInstance(ctx, "pointvector"));
    strategies.add(BBoxStrategy.newInstance(ctx, "bbox"));
    final SerializedDVStrategy serialized = new SerializedDVStrategy(ctx, "serialized");
    strategies.add(serialized);
    strategies.add(new CompositeSpatialStrategy("composite", recursive_geohash, serialized));
    for (SpatialStrategy strategy : strategies) {
        testEqualsHashcode(strategy);
    }
}
Also used : CompositeSpatialStrategy(org.apache.lucene.spatial.composite.CompositeSpatialStrategy) QuadPrefixTree(org.apache.lucene.spatial.prefix.tree.QuadPrefixTree) ArrayList(java.util.ArrayList) RecursivePrefixTreeStrategy(org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy) SpatialPrefixTree(org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree) CompositeSpatialStrategy(org.apache.lucene.spatial.composite.CompositeSpatialStrategy) TermQueryPrefixTreeStrategy(org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy) SerializedDVStrategy(org.apache.lucene.spatial.serialized.SerializedDVStrategy) GeohashPrefixTree(org.apache.lucene.spatial.prefix.tree.GeohashPrefixTree) Test(org.junit.Test)

Aggregations

SerializedDVStrategy (org.apache.lucene.spatial.serialized.SerializedDVStrategy)6 CompositeSpatialStrategy (org.apache.lucene.spatial.composite.CompositeSpatialStrategy)4 RecursivePrefixTreeStrategy (org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy)3 ArrayList (java.util.ArrayList)2 TermQueryPrefixTreeStrategy (org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy)2 GeohashPrefixTree (org.apache.lucene.spatial.prefix.tree.GeohashPrefixTree)2 QuadPrefixTree (org.apache.lucene.spatial.prefix.tree.QuadPrefixTree)2 SpatialPrefixTree (org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree)2 Test (org.junit.Test)2 ParametersFactory (com.carrotsearch.randomizedtesting.annotations.ParametersFactory)1 Repeat (com.carrotsearch.randomizedtesting.annotations.Repeat)1 ValueSource (org.apache.lucene.queries.function.ValueSource)1 MatchAllDocsQuery (org.apache.lucene.search.MatchAllDocsQuery)1 SpatialStrategy (org.apache.lucene.spatial.SpatialStrategy)1 PackedQuadPrefixTree (org.apache.lucene.spatial.prefix.tree.PackedQuadPrefixTree)1 SpatialOperation (org.apache.lucene.spatial.query.SpatialOperation)1 SolrDocument (org.apache.solr.common.SolrDocument)1 SolrException (org.apache.solr.common.SolrException)1 JSONResponseWriter (org.apache.solr.response.JSONResponseWriter)1 QueryResponseWriter (org.apache.solr.response.QueryResponseWriter)1