Package org.apache.lucene.search

Examples of org.apache.lucene.search.MatchAllDocsQuery


    FacetSearchParams fsp = new FacetSearchParams(requests);
   
    FacetsCollector c = FacetsCollector.create(new SortedSetDocValuesAccumulator(state, fsp));

    searcher.search(new MatchAllDocsQuery(), c);

    try {
      c.getFacetResults();
      fail("did not hit expected exception");
    } catch (IllegalStateException ise) {
View Full Code Here


    accumulator
        .setComplementThreshold(OldFacetsAccumulator.DISABLE_COMPLEMENT);
   
    FacetsCollector fc = FacetsCollector.create(accumulator);
   
    searcher.search(new MatchAllDocsQuery(), fc);
    FacetResultNode node = fc.getFacetResults().get(0).getFacetResultNode();
   
    assertTrue(node.value < numDocsToIndex());
  }
View Full Code Here

        try {
          FacetSearchParams fsp = new FacetSearchParams(iParams, new CountFacetRequest(new CategoryPath("a"), 10),
              new CountFacetRequest(new CategoryPath("b"), 10));
          IndexSearcher searcher = new IndexSearcher(indexReader);
          FacetsCollector fc = FacetsCollector.create(fsp, indexReader, taxoReader);
          searcher.search(new MatchAllDocsQuery(), fc);
          results = fc.getFacetResults();
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
View Full Code Here

        try {
          FacetSearchParams fsp = new FacetSearchParams(iParams, new CountFacetRequest(new CategoryPath("a"), 10),
              new CountFacetRequest(new CategoryPath("b"), 10));
          IndexSearcher searcher = new IndexSearcher(indexReader);
          FacetsCollector fc = FacetsCollector.create(fsp, indexReader, taxoReader);
          searcher.search(new MatchAllDocsQuery(), fc);
          results = fc.getFacetResults();
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
View Full Code Here

        new LongRange("over 1000", 1000L, false, Long.MAX_VALUE, true)));
   
    FacetsCollector fc = FacetsCollector.create(a);

    IndexSearcher s = newSearcher(r);
    s.search(new MatchAllDocsQuery(), fc);
    List<FacetResult> result = fc.getFacetResults();
    assertEquals(1, result.size());
    assertEquals("field (0)\n  less than 10 (10)\n  less than or equal to 10 (11)\n  over 90 (9)\n  90 or above (10)\n  over 1000 (1)\n", FacetTestUtils.toSimpleString(result.get(0)));
   
    r.close();
View Full Code Here

          return random().nextBoolean();
        }
      };

    // First search, no drill downs:
    DrillDownQuery ddq = new DrillDownQuery(FacetIndexingParams.DEFAULT, new MatchAllDocsQuery());
    DrillSidewaysResult dsr = ds.search(null, ddq, 10, fsp);

    assertEquals(100, dsr.hits.totalHits);
    assertEquals(2, dsr.facetResults.size());
    assertEquals("dim (0)\n  b (75)\n  a (25)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(0)));
    assertEquals("field (0)\n  less than 10 (10)\n  less than or equal to 10 (11)\n  over 90 (9)\n  90 or above (10)\n  over 1000 (0)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(1)));

    // Second search, drill down on dim=b:
    ddq = new DrillDownQuery(FacetIndexingParams.DEFAULT, new MatchAllDocsQuery());
    ddq.add(new CategoryPath("dim", "b"));
    dimSeen.clear();
    dsr = ds.search(null, ddq, 10, fsp);

    assertEquals(75, dsr.hits.totalHits);
    assertEquals(2, dsr.facetResults.size());
    assertEquals("dim (0)\n  b (75)\n  a (25)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(0)));
    assertEquals("field (0)\n  less than 10 (7)\n  less than or equal to 10 (8)\n  over 90 (7)\n  90 or above (8)\n  over 1000 (0)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(1)));

    // Third search, drill down on "less than or equal to 10":
    ddq = new DrillDownQuery(FacetIndexingParams.DEFAULT, new MatchAllDocsQuery());
    ddq.add("field", NumericRangeQuery.newLongRange("field", 0L, 10L, true, true));
    dimSeen.clear();
    dsr = ds.search(null, ddq, 10, fsp);

    assertEquals(11, dsr.hits.totalHits);
View Full Code Here

          return random().nextBoolean();
        }
      };

    // First search, no drill downs:
    DrillDownQuery ddq = new DrillDownQuery(FacetIndexingParams.DEFAULT, new MatchAllDocsQuery());
    DrillSidewaysResult dsr = ds.search(null, ddq, 10, fsp);

    assertEquals(100, dsr.hits.totalHits);
    assertEquals(2, dsr.facetResults.size());
    assertEquals("dim (0)\n  b (75)\n  a (25)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(0)));
    assertEquals("field (0)\n  less than 10 (10)\n  less than or equal to 10 (11)\n  over 90 (9)\n  90 or above (10)\n  over 1000 (0)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(1)));

    // Second search, drill down on dim=b:
    ddq = new DrillDownQuery(FacetIndexingParams.DEFAULT, new MatchAllDocsQuery());
    ddq.add(new CategoryPath("dim", "b"));
    dimSeen.clear();
    dsr = ds.search(null, ddq, 10, fsp);

    assertEquals(75, dsr.hits.totalHits);
    assertEquals(2, dsr.facetResults.size());
    assertEquals("dim (0)\n  b (75)\n  a (25)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(0)));
    assertEquals("field (0)\n  less than 10 (7)\n  less than or equal to 10 (8)\n  over 90 (7)\n  90 or above (8)\n  over 1000 (0)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(1)));

    // Third search, drill down on "less than or equal to 10":
    ddq = new DrillDownQuery(FacetIndexingParams.DEFAULT, new MatchAllDocsQuery());
    ddq.add("field", NumericRangeQuery.newLongRange("field", 0L, 10L, true, true));
    dimSeen.clear();
    dsr = ds.search(null, ddq, 10, fsp);

    assertEquals(11, dsr.hits.totalHits);
View Full Code Here

        new DoubleRange("over 1000", 1000.0, false, Double.POSITIVE_INFINITY, false)));
   
    FacetsCollector fc = FacetsCollector.create(a);

    IndexSearcher s = newSearcher(r);
    s.search(new MatchAllDocsQuery(), fc);
    List<FacetResult> result = fc.getFacetResults();
    assertEquals(1, result.size());
    assertEquals("field (0)\n  less than 10 (10)\n  less than or equal to 10 (11)\n  over 90 (9)\n  90 or above (10)\n  over 1000 (0)\n", FacetTestUtils.toSimpleString(result.get(0)));
   
    r.close();
View Full Code Here

        new FloatRange("over 1000", 1000.0f, false, Float.POSITIVE_INFINITY, false)));
   
    FacetsCollector fc = FacetsCollector.create(a);

    IndexSearcher s = newSearcher(r);
    s.search(new MatchAllDocsQuery(), fc);
    List<FacetResult> result = fc.getFacetResults();
    assertEquals(1, result.size());
    assertEquals("field (0)\n  less than 10 (10)\n  less than or equal to 10 (11)\n  over 90 (9)\n  90 or above (10)\n  over 1000 (0)\n", FacetTestUtils.toSimpleString(result.get(0)));
   
    r.close();
View Full Code Here

          }
        }
      }

      FacetsCollector fc = FacetsCollector.create(new RangeAccumulator(new RangeFacetRequest<LongRange>("field", ranges)));
      s.search(new MatchAllDocsQuery(), fc);
      List<FacetResult> results = fc.getFacetResults();
      assertEquals(1, results.size());
      List<FacetResultNode> nodes = results.get(0).getFacetResultNode().subResults;
      assertEquals(numRange, nodes.size());
      for(int rangeID=0;rangeID<numRange;rangeID++) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.MatchAllDocsQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.