Package org.apache.lucene.search.join

Examples of org.apache.lucene.search.join.BlockJoinCollector


    // Combine the parent and nested child queries into a single query for a candidate
    BooleanQuery fullQuery = new BooleanQuery();
    fullQuery.add(new BooleanClause(parentQuery, Occur.MUST));
    fullQuery.add(new BooleanClause(childJoinQuery, Occur.MUST));

    BlockJoinCollector c = new BlockJoinCollector(Sort.RELEVANCE, 1, true, false);

    s.search(fullQuery, c);
   
    TopGroups<Integer> results = c.getTopGroups(childJoinQuery, null, 0, 10, 0, true);

    //assertEquals(1, results.totalHitCount);
    assertEquals(1, results.totalGroupedHitCount);
    assertEquals(1, results.groups.length);
View Full Code Here


            System.out.println();
          }
        }
      }
     
      final BlockJoinCollector c = new BlockJoinCollector(parentSort, 10, true, true);

      joinS.search(parentJoinQuery, c);

      final int hitsPerGroup = _TestUtil.nextInt(random, 1, 20);
      //final int hitsPerGroup = 100;
      final TopGroups<Integer> joinResults = c.getTopGroups(childJoinQuery, childSort, 0, hitsPerGroup, 0, true);

      if (VERBOSE) {
        System.out.println("\nTEST: block join index gets " + (joinResults == null ? 0 : joinResults.groups.length) + " groups; hitsPerGroup=" + hitsPerGroup);
        if (joinResults != null) {
          final GroupDocs<Integer>[] groups = joinResults.groups;
View Full Code Here

    // Combine the parent and nested child queries into a single query for a candidate
    BooleanQuery fullQuery = new BooleanQuery();
    fullQuery.add(new BooleanClause(parentQuery, Occur.MUST));
    fullQuery.add(new BooleanClause(childJoinQuery, Occur.MUST));

    BlockJoinCollector c = new BlockJoinCollector(Sort.RELEVANCE, 1, true, false);

    s.search(fullQuery, c);
   
    TopGroups<Integer> results = c.getTopGroups(childJoinQuery, null, 0, 10, 0, true);

    //assertEquals(1, results.totalHitCount);
    assertEquals(1, results.totalGroupedHitCount);
    assertEquals(1, results.groups.length);
View Full Code Here

            System.out.println();
          }
        }
      }
     
      final BlockJoinCollector c = new BlockJoinCollector(parentSort, 10, true, true);

      joinS.search(parentJoinQuery, c);

      final int hitsPerGroup = _TestUtil.nextInt(random, 1, 20);
      //final int hitsPerGroup = 100;
      final TopGroups<Integer> joinResults = c.getTopGroups(childJoinQuery, childSort, 0, hitsPerGroup, 0, true);

      if (VERBOSE) {
        System.out.println("\nTEST: block join index gets " + (joinResults == null ? 0 : joinResults.groups.length) + " groups; hitsPerGroup=" + hitsPerGroup);
        if (joinResults != null) {
          final GroupDocs<Integer>[] groups = joinResults.groups;
View Full Code Here

    fullQuery.add(new BooleanClause(parentQuery, Occur.MUST));
    fullQuery.add(new BooleanClause(childJobJoinQuery, Occur.MUST));
    fullQuery.add(new BooleanClause(childQualificationJoinQuery, Occur.MUST));

    //????? How do I control volume of jobs vs qualifications per parent?
    BlockJoinCollector c = new BlockJoinCollector(Sort.RELEVANCE, 10, true, false);

    s.search(fullQuery, c);

    //Examine "Job" children
    boolean showNullPointerIssue=true;
    if (showNullPointerIssue) {
      TopGroups<Integer> jobResults = c.getTopGroups(childJobJoinQuery, null, 0, 10, 0, true);

      //assertEquals(1, results.totalHitCount);
      assertEquals(1, jobResults.totalGroupedHitCount);
      assertEquals(1, jobResults.groups.length);

      final GroupDocs<Integer> group = jobResults.groups[0];
      assertEquals(1, group.totalHits);

      Document childJobDoc = s.doc(group.scoreDocs[0].doc);
      //System.out.println("  doc=" + group.scoreDocs[0].doc);
      assertEquals("java", childJobDoc.get("skill"));
      assertNotNull(group.groupValue);
      Document parentDoc = s.doc(group.groupValue);
      assertEquals("Lisa", parentDoc.get("name"));
    }

    //Now Examine qualification children
    TopGroups<Integer> qualificationResults = c.getTopGroups(childQualificationJoinQuery, null, 0, 10, 0, true);

    //!!!!! This next line can null pointer - but only if prior "jobs" section called first
    assertEquals(1, qualificationResults.totalGroupedHitCount);
    assertEquals(1, qualificationResults.groups.length);
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.join.BlockJoinCollector

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.