Package com.flaptor.indextank.index

Examples of com.flaptor.indextank.index.Document


        Document dd1 = storage.getDocument("a");
        assertEquals("document retrieved didn't match document stored", doc1, dd1);
    }
    @TestInfo(testType=TestType.UNIT)
    public void testNonTextOnlyDocument() throws InterruptedException {
        Document doc2 = new Document();
        doc2.setField("nottext", text);
        storage.saveDocument("b", doc2);
        Document dd2 = storage.getDocument("b");
        assertEquals("document retrieved didn't match document stored", doc2, dd2);
    }
View Full Code Here


        Document dd2 = storage.getDocument("b");
        assertEquals("document retrieved didn't match document stored", doc2, dd2);
    }
    @TestInfo(testType=TestType.UNIT)
    public void testMixedDocument() throws InterruptedException {
        Document doc3 = new Document();
        doc3.setField("text", text);
        doc3.setField("f1", "v1");
        doc3.setField("f2", "v2");
        storage.saveDocument("c", doc3);
        Document dd3 = storage.getDocument("c");
        assertEquals("document retrieved didn't match document stored", doc3, dd3);
    }
View Full Code Here

        Document dd3 = storage.getDocument("c");
        assertEquals("document retrieved didn't match document stored", doc3, dd3);
    }
    @TestInfo(testType=TestType.UNIT)
    public void testEmptyTextDocument() throws InterruptedException {
        Document doc3 = new Document();
        doc3.setField("text", "");
        doc3.setField("f1", "v1");
        doc3.setField("f2", "v2");
        storage.saveDocument("c", doc3);
        Document dd3 = storage.getDocument("c");
        assertEquals("document retrieved didn't match document stored", doc3, dd3);
    }
View Full Code Here

  @TestInfo(testType=UNIT)
  public void testCheckpoint() throws IOException, InterruptedException {
        List<Document> docs = Lists.newArrayList();
        int limit = 10;
        for (int i = 0; i < limit; i++) {
            Document doc = new Document();
            doc.setField("fieldA","A term"+i);
            doc.setField("fieldB","B term"+i);
            docs.add(doc);
        }
     

        this.lsi.add("first_doc", docs.get(0));
View Full Code Here

  @TestInfo(testType=UNIT)
  public void testEnqueuesWhileProcessingQueue() throws IOException, InterruptedException {
        List<Document> docs = Lists.newArrayList();
        int limit = 10;
        for (int i = 0; i < limit; i++) {
            Document doc = new Document();
            doc.setField("fieldA","A term"+i);
            doc.setField("fieldB","B term"+i);
            docs.add(doc);
        }
        Document doc = new IndexTriggeringDocument(this.lsi,"badapple");
        doc.setField("version","first");
        doc.setField("pepe","badapple");
        docs.add(doc);


        IndexingDumpCompletionListener idcl = new IndexingDumpCompletionListener(this.lsi,docs);
        idcl.start();
View Full Code Here

        }

        public void dumpCompleted(){
            try {
                this.join();
                Document doc = new Document();
                doc.setField("fieldA","checkpoint");
                this.lsi.add("checkpoint_doc",doc);
            } catch (InterruptedException ie){
                // TODO log this 
            } finally {
                this.called = true;
View Full Code Here

        public Set<String> getFieldNames(){
            // Trigger the indexing of an update of self.
            // This method should be only called when indexing, so this is kinda safe.
            if (!this.triggered) {
                Document doc = new Document();
                doc.setField("version","latest");
                doc.setField("pepe",this.getField("pepe"));
                this.lsi.add(this.doc_id,doc);
                this.triggered = true;
                Execute.sleep(100);
            }
            return super.getFieldNames();
View Full Code Here

        FileUtil.deleteDir(tempDir);
  }
 
  @TestInfo(testType=UNIT)
  public void testUpdates() throws IOException {
        Document doc = new Document();
        doc.setField("fieldA","A");
        doc.setField("fieldB","B");

        lsiIndexer.add("A",doc);
        lsiIndexer.add("A",doc);

        doc.setField("fieldC","C");
        lsiIndexer.add("A",doc);
        lsiIndexer.makeDirectoryCheckpoint();

        assertEquals("Wrong document count", 1, index.getLuceneIndexWriter().numDocs());
        assertTrue("fieldC not found", index.getLuceneIndexWriter().getReader().getFieldNames(IndexReader.FieldOption.INDEXED).contains("fieldC"));
View Full Code Here

        assertTrue("fieldC not found", index.getLuceneIndexWriter().getReader().getFieldNames(IndexReader.FieldOption.INDEXED).contains("fieldC"));
  }
 
    @TestInfo(testType=UNIT)
  public void testHandleDeletes() throws IOException, InterruptedException {
        Document doc = new Document();
        doc.setField("fieldA","A");
        doc.setField("fieldB","B");

        lsiIndexer.add("A",doc);
        lsiIndexer.add("A",doc);
        lsiIndexer.add("A",doc);
        lsiIndexer.del("A");
View Full Code Here

        assertEquals("Wrong document count", 0, index.getLuceneIndexWriter().numDocs());
  }
   
    @TestInfo(testType=UNIT)
  public void testHandleAddAfterDelete() throws IOException, InterruptedException {
        Document doc = new Document();
        doc.setField("fieldA","A");
        doc.setField("fieldB","B");

        lsiIndexer.add("A",doc);
        lsiIndexer.del("A");
        lsiIndexer.add("A",doc);
        lsiIndexer.makeDirectoryCheckpoint();
View Full Code Here

TOP

Related Classes of com.flaptor.indextank.index.Document

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.