Package com.flaptor.hounder.searcher.query

Examples of com.flaptor.hounder.searcher.query.TermQuery


        int[] lenA={40};
        String[] fieldA={"text"};
        snippetSearcher= new SnippetSearcher(new CompositeSearcher(), fieldA, lenA, FRAG_SEP, PHRASE_BOUND, false, "<B>", "</B>");

        GroupedSearchResults results;       
        results = snippetSearcher.search(new TermQuery("text", "debut"), 0, 10, new NoGroup(), 1, null, null);
        assertEquals("We get a bad number of groups", 1, results.groups());
        assertEquals("We get a bad number of results within the group", 1, results.getGroup(0).last().size());
        org.apache.lucene.document.Document doc= results.getGroup(0).last().get(0);
        String content= StringUtil.nullToEmpty(doc.get(SnippetSearcher.SNIPPET_FIELDNAME_PREFIX + "text")).trim();
        assertTrue("The returned snippet is not as expected", content.contains("querido su <B>debut</B> como"));
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

        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.query.TermQuery

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.