Package com.flaptor.hounder.searcher

Examples of com.flaptor.hounder.searcher.GroupedSearchResults


        Config searcherConfig = Config.getConfig("searcher.properties");
        searcherConfig.set("compositeSearcher.useSpellCheckSuggestQuery", "true");
        searcherConfig.set("searcher.suggestQuerySearcher.dictionaryDir", spellDir.getFile().getAbsolutePath());
        searcher = new CompositeSearcher();

        GroupedSearchResults res = searcher.search(new LazyParsedQuery("contentb"), 0, 10, null, 20, null, null);
        assertEquals(1, res.totalGroupsEstimation());
        res = searcher.search(new LazyParsedQuery("content"), 0, 10, null, 20, null, null);
        assertEquals(0, res.totalGroupsEstimation());
        assertNotNull(res.getSuggestedQuery());
        res = searcher.search(res.getSuggestedQuery(), 0, 10, null, 20, null, null);
        assertEquals(1, res.totalGroupsEstimation());

        searcherConfig.set("compositeSearcher.useSuggestQuery", "false");
    }
View Full Code Here


            requiresPort = {10000, 10001, 10010, 10011, 10012})
  public void testIndexingDocumentBoost()  throws SearcherException{
    indexer.index(addC);
    indexer.index(addCb);
    Execute.sleep(8000);
    GroupedSearchResults sr = searcher.search(new TermQuery("content", "contentc"), 0, 10,noGroup, 1, null, null);
    assertEquals(2, sr.totalGroupsEstimation());
    Document d1 = sr.getGroup(0).last().elementAt(0);
    assertEquals("cb", d1.get("docId"));
    Document d2 = sr.getGroup(1).last().elementAt(0);
    assertEquals("c", d2.get("docId"));
  }
View Full Code Here

   */
    @TestInfo(testType = TestInfo.TestType.SYSTEM,
            requiresPort = {10000, 10001, 10010, 10011, 10012})
  public void testWhatYouAddIsWhatYouGet()  throws SearcherException{
    Execute.sleep(8000);
    GroupedSearchResults sr = searcher.search(new TermQuery("content", "contenta"), 0, 10, noGroup, 1, null, null);
    assertEquals(0, sr.totalGroupsEstimation());
    Execute.sleep(8000);
    sr = searcher.search(new TermQuery("content", "contentb"), 0, 10, noGroup, 1, null, null);
    assertEquals(0, sr.totalGroupsEstimation());

    indexer.index(addA);
    Execute.sleep(8000);
    sr = searcher.search(new TermQuery("content", "contenta"), 0, 10, noGroup,1, null, null);
    assertEquals(1, sr.totalGroupsEstimation());
    sr = searcher.search(new TermQuery("content", "contentb"), 0, 10, noGroup, 1, null, null);
    assertEquals(0, sr.totalGroupsEstimation());

    indexer.index(addB);
    Execute.sleep(8000);
    sr = searcher.search(new TermQuery("content", "contenta"), 0, 10, noGroup, 1, null, null);
    assertEquals(1, sr.totalGroupsEstimation());
    sr = searcher.search(new TermQuery("content", "contentb"), 0, 10, noGroup, 1, null, null);
    assertEquals(1, sr.totalGroupsEstimation());

  }
View Full Code Here

    indexer.index(addA);
    indexer.index(addB);
    Execute.sleep(8000);

    AFilter filter = new ValueFilter("nonExistentField", "noValue");
    GroupedSearchResults sr = searcher.search(new MatchAllQuery(), 0, 10, noGroup, 1, filter, null);
    assertEquals(0, sr.totalGroupsEstimation());
  }
View Full Code Here

            requiresPort = {10000, 10001, 10010, 10011, 10012})
  public void testValueFilter()  throws SearcherException{
    indexer.index(addA);
    indexer.index(addB);
    Execute.sleep(8000);
    GroupedSearchResults sr = searcher.search(new MatchAllQuery(), 0, 10, noGroup, 1, null, null);
    assertEquals(2, sr.totalGroupsEstimation());

    AFilter filter = new ValueFilter("content", "contenta");
    sr = searcher.search(new MatchAllQuery(), 0, 10, noGroup, 1, filter, null);
    assertEquals(1, sr.totalGroupsEstimation());
  }
View Full Code Here

        indexer.index(group1b);
        indexer.index(group2a);
        indexer.index(group2b);
        indexer.index(group3a);
    Execute.sleep(8000);
        GroupedSearchResults gsr = searcher.search(new MatchAllQuery(),0,3,new StoredFieldGroup("group"),2,null,new FieldSort(false,"group",FieldSort.OrderType.STRING));

        assertEquals(3,gsr.groups());
        assertEquals(2,gsr.getGroup(0).last().size());
        assertEquals(2,gsr.getGroup(1).last().size());
        assertEquals(1,gsr.getGroup(2).last().size());
    }
View Full Code Here

        indexer.index(group1b);
        indexer.index(group2a);
        indexer.index(group2b);
        indexer.index(group3a);
    Execute.sleep(8000);
        GroupedSearchResults sr = searcher.search(new MatchAllQuery(),0,3,new StoredFieldGroup("group"), 5,null,null);

        assertEquals(3,sr.groups());
    }
View Full Code Here

        indexer.index(group2a);
        indexer.index(group2b);
        indexer.index(group3a);
        Execute.sleep(8000);

        GroupedSearchResults newGsr, gsr;
        float newHitRatio, hitRatio;

        newGsr = cacheSearcher.search(new MatchAllQuery(),0,3,new StoredFieldGroup("group"),2,null,new FieldSort(false,"group",FieldSort.OrderType.STRING));
        newHitRatio = cache.getHitRatio();
        for (int i = 0; i < 20; ++i) {
View Full Code Here

        baseSearcher = (Searcher)searcher.getBaseSearcher();
        unfilterOutput();

        if (!validIndexPresent) filterOutput("No indexId active");
        try {
            GroupedSearchResults sr = searcher.search(new TermQuery("content", "contenta"), 0, 10, noGroup, 1, null, null);
            if (!validIndexPresent) fail("Search on an invalid index did not fail as expected");
        } catch (NoIndexActiveException e) {
            if (validIndexPresent) throw e;
        }
        unfilterOutput();
View Full Code Here

        Execute.sleep(10000);


        // perform query
        GroupedSearchResults gsr = searcher.search(new TermQuery("content", "contenta"), 0, 10, new NoGroup(), 1, null, null);
        assertEquals(gsr.groups(),2);

        // check that small payload is first, if we do not use payloads.
        assertEquals(gsr.getGroup(0).last().get(0).get("docId"),"small");
        assertEquals(gsr.getGroup(1).last().get(0).get("docId"),"big");


        // override config, so payloads are used
        searcherConfig.set("SimilarityForwarder.scorers","payload:com.flaptor.hounder.searcher.payload.DatePayloadScorer");

        // restart searcher
        stopSearcher();
        searcher = new CompositeSearcher();
        Execute.sleep(10000);

        // perform query
        gsr = searcher.search(new AndQuery(new TermQuery("content", "contenta"),new PayloadQuery("payload")), 0, 10, new NoGroup(), 1, null, null);
        assertEquals(gsr.groups(),2);

        // check that now, using payloads, big payload is first
        assertEquals("big", gsr.getGroup(0).last().get(0).get("docId"));
        assertEquals("small", gsr.getGroup(1).last().get(0).get("docId"));
    }
View Full Code Here

TOP

Related Classes of com.flaptor.hounder.searcher.GroupedSearchResults

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.