Package com.gentics.cr.lucene.search.query.mocks

Examples of com.gentics.cr.lucene.search.query.mocks.ComparableDocument


  @Override
  protected void setUp() throws Exception {
    super.setUp();
    document1 = new Document();
    document1.add(new Field(SimpleLucene.CONTENT_ATTRIBUTE, "document1", Field.Store.YES, Field.Index.ANALYZED));
    cd1 = new ComparableDocument(document1);
    document2 = new Document();
    document2.add(new Field(SimpleLucene.CONTENT_ATTRIBUTE, "document2", Field.Store.YES, Field.Index.ANALYZED));
    cd2 = new ComparableDocument(document2);
    document3 = new Document();
    document3.add(new Field(SimpleLucene.CONTENT_ATTRIBUTE, "document3", Field.Store.YES, Field.Index.ANALYZED));
    cd3 = new ComparableDocument(document3);

    documents = new ArrayList<ComparableDocument>();
    documents.add(cd1);
    documents.add(cd2);
View Full Code Here


    documents.add(cd2);

  }

  public void selfTest() {
    containsAll(documents, new ComparableDocument[] { new ComparableDocument(document1),
        new ComparableDocument(document2), new ComparableDocument(document3) });
    documents.remove(cd2);
    documents.remove(cd3);
    containsOnly(documents, new ComparableDocument(document1));
  }
View Full Code Here

  }
 
  public Collection<ComparableDocument> wrapComparable(Collection<Document> docColl) {
    Collection<ComparableDocument> ret = new Vector<ComparableDocument>();
    for (Document d : docColl) {
      ret.add(new ComparableDocument(d));
    }
    return ret;
  }
View Full Code Here

    parser = new CRQueryParser(LuceneVersion.getVersion(), SEARCHED_ATTRIBUTES, STANDARD_ANALYZER);
    crRequest = new CRRequest();
    lucene = new SimpleLucene();

    documents = new ArrayList<ComparableDocument>();
    /* 0 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word9 word1",
      "node_id:1")));
    /* 1 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word2 word9",
      "node_id:1")));
    /* 2 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word3",
      "binarycontent:word9",
      "node_id:2")));
    /* 3 */documents.add(new ComparableDocument(lucene.add(SimpleLucene.CONTENT_ATTRIBUTE
        + ":wörd4 with-minusinit with-minus-in-it", "node_id:2")));
    /* 4 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word5 minusinit with",
      "updatetimestamp:1311604678",
      "edittimestamp:1311604678",
      "node_id:3"))); //25.07.2011 16:37:58
    /* 5 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word6",
      "updatetimestamp:1313160620",
      "edittimestamp:1313160620",
      "node_id:3"))); //12.08.2011 16:50:20
    /* 6 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word7",
      "updatetimestamp:1314627329",
      "edittimestamp:1314627329",
      "node_id:3"))); //29.08.2011 16:15:29
    /* 7 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word8 01",
      "updatetimestamp:1304510397",
      "edittimestamp:1304510397",
      "node_id:3"))); //04.05.2011 13:59:57
    /* 8 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":newword 01/23456789",
      "node_id:11")));

  }
View Full Code Here

    parser = new CRQueryParser(LuceneVersion.getVersion(), SEARCHED_ATTRIBUTES, STANDARD_ANALYZER);
    crRequest = new CRRequest();
    lucene = new SimpleLucene();

    documents = new ArrayList<ComparableDocument>();
    /* 0 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word9 word1",
      "node_id:1")));
    /* 1 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word2 word9",
      "node_id:1")));
    /* 2 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word3",
      "binarycontent:word9",
      "node_id:2")));
    /* 3 */documents
        .add(new ComparableDocument(lucene.add(SimpleLucene.CONTENT_ATTRIBUTE + ":wörd4", "node_id:2")));
    /* 4 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word5",
      "updatetimestamp:1311604678",
      "edittimestamp:1311604678",
      "node_id:3"))); //25.07.2011 16:37:58
    /* 5 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word6",
      "updatetimestamp:1313160620",
      "edittimestamp:1313160620",
      "node_id:3"))); //12.08.2011 16:50:20
    /* 6 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word7",
      "updatetimestamp:1314627329",
      "edittimestamp:1314627329",
      "node_id:3"))); //29.08.2011 16:15:29
    /* 7 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word8",
      "updatetimestamp:1304510397",
      "edittimestamp:1304510397",
      "node_id:3"))); //04.05.2011 13:59:57
    /* 8 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":newword",
      "node_id:11")));

  }
View Full Code Here

    long daysAgo10 = today - 3600*24*10;
    long daysAgo20 = today - 3600*24*20;
    long daysAgo30 = today - 3600*24*30;
   
    documents = new ArrayList<ComparableDocument>();
    /* 0 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word1 today",
      "updatetimestamp:"+today,
      "node_id:2")));
    /* 1 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word2 word9",
      "updatetimestamp:1349042400",
      "node_id:8"))); // 01.10.2012 00:00:00
    /* 2 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word3",
      "updatetimestamp:1347228000",
      "binarycontent:word9",
      "node_id:8"))); // 10.09.2012 00:00:00
    /* 3 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word1 daysAgo30",
      "updatetimestamp:"+daysAgo30,
      "node_id:7")));
    /* 4 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word5",
      "updatetimestamp:1346450400",
      "node_id:8"))); // 01.09.2012 00:00:00
    /* 5 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word1 word1 today",
      "updatetimestamp:"+today,
      "node_id:1")));
    /* 6 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word1 daysAgo20",
      "updatetimestamp:"+daysAgo20,
      "node_id:6")));
    /* 7 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word1 daysAgo10",
      "updatetimestamp:"+daysAgo10,
      "node_id:4")));
    /* 8 */documents.add(new ComparableDocument(lucene.add(
        SimpleLucene.CONTENT_ATTRIBUTE + ":word1 word1 word1 word1 word1 word1 word1 daysAgo30",
        "updatetimestamp:"+daysAgo30,
        "node_id:5")));
  }
View Full Code Here

TOP

Related Classes of com.gentics.cr.lucene.search.query.mocks.ComparableDocument

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.