Package com.flaptor.indextank.query

Examples of com.flaptor.indextank.query.TermQuery


        IndexingDumpCompletionListener idcl = new IndexingDumpCompletionListener(this.lsi,docs);
        idcl.start();
        this.lsi.startDump(idcl);
        idcl.waitUntilCompleted();

        assertEquals("Checkpoint made it to the index", 0, lsi.findMatches(new Query(new TermQuery("documentId","checkpoint_doc"),null,null),1, 1).getTotalMatches());
        assertEquals("First doc didn't make it to the index", 1, lsi.findMatches(new Query(new TermQuery("documentId","first_doc"),null,null),1, 1).getTotalMatches());
        // TODO test there is only one thing on the index.
       
        this.lsi.startDump(new DummyDumpCompletionListener());
        assertEquals("Checkpoint didn't make it to the index", 1, lsi.findMatches(new Query(new TermQuery("documentId","checkpoint_doc"),null,null),1, 1).getTotalMatches());
        assertEquals("First doc didn't make it to the index", 1, lsi.findMatches(new Query(new TermQuery("documentId","first_doc"),null,null),1, 1).getTotalMatches());
        // TODO test that there are limit + 2 documents on the index

  }
View Full Code Here


        IndexingDumpCompletionListener idcl = new IndexingDumpCompletionListener(this.lsi,docs);
        idcl.start();
        this.lsi.startDump(idcl);
        idcl.waitUntilCompleted();
       
        assertEquals("Bad Apple made it to the index", 0, lsi.findMatches(new Query(new TermQuery("pepe","badapple"),null,null),1, 0).getTotalMatches());

        Execute.sleep(1000);
        docs = Lists.newArrayList();
        idcl = new IndexingDumpCompletionListener(this.lsi,docs);
        idcl.start();
        this.lsi.startDump(idcl);
        idcl.waitUntilCompleted();

        assertEquals("I expected just ONE bad apple", 1, lsi.findMatches(new Query(new TermQuery("pepe","badapple"),null,null),1, 0).getTotalMatches());
        assertEquals("I expected one document that matched version:latest", 1, lsi.findMatches(new Query(new TermQuery("version","latest"),null,null),1, 0).getTotalMatches());
       
    }
View Full Code Here

    private Query dummyQuery;

    @Override
  protected void setUp() throws Exception {
        super.setUp();
        dummyQuery = new Query(new TermQuery("foo", "bar"),null,null);
        res1 = new MockSearchResults();
        res2 = new MockSearchResults();
        LargeScaleIndex lsi = new LargeScaleIndexStub(res1);
        RealTimeIndex rti = new RealTimeIndexStub(res2, 100);
        blender = new Blender(lsi,rti, new NoSuggestor(), new DummyPromoter(), new DummyBoostsManager());
View Full Code Here

        sleep(100);
        new Thread(new RunSearch(sleepSearcher)).start();
        sleep(100);
        // now start one that should throw an exception because the queue is at max length
        try {
            final Query query = new Query(new TermQuery("text", "nada"), null, null);
            sleepSearcher.search(query, 0, 10, 0);
            fail("Should have thrown InterruptedException");
        } catch (InterruptedException e) {
            System.out.println("InterruptedException thrown, success");
        }
View Full Code Here

    @TestInfo(testType=UNIT)
    public void testNonConcurrentSearching() throws InterruptedException {
        // make sure serial searches don't cause an InterruptedException
        for (int i = 0; i < 100; i++) {
            final Query query = new Query(new TermQuery("text", "nada"), null, null);
            fastSearcher.search(query, 0, 10, 0);
        }
    }
View Full Code Here

        }

        @Override
        public void run() {
            try {
                final Query query = new Query(new TermQuery("text","hola"),null,null);
                searcher.search(query, 0, 10, 0);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
View Full Code Here

TOP

Related Classes of com.flaptor.indextank.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.