Package ch.entwine.weblounge.common.content

Examples of ch.entwine.weblounge.common.content.SearchQuery


    // Make sure the search index is still consistent after an update. For this,
    // test one of the constructed fields that are not returned as part of the
    // search result and therefore are likely to be lost

    SearchQuery q = new SearchQueryImpl(site).withProperty(propertyName, propertyValue);
    SearchResult result = searchIdx.getByQuery(q);
    assertEquals(1, result.getDocumentCount());
    assertEquals(page.getURI().getIdentifier(), result.getItems()[0].getId());
  }
View Full Code Here


   * .
   */
  @Test
  public void testGetWithId() throws Exception {
    populateIndex();
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withIdentifier(uuid1);
    assertEquals(1, idx.getByQuery(q).getDocumentCount());
  }
View Full Code Here

   * .
   */
  @Test
  public void testGetWithPath() throws Exception {
    populateIndex();
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPath(path1);
    assertEquals(1, idx.getByQuery(q).getDocumentCount());
  }
View Full Code Here

      p = new PageImpl(uri);
      p.setTemplate(template.getIdentifier());
      idx.add(p);
    }

    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPathPrefix(path1);
    q.withLimit(100);
    assertEquals(21, idx.getByQuery(q).getDocumentCount());
  }
View Full Code Here

    Pagelet[] mainPagelets = pages[0].getPagelets("main");
    Pagelet titlePagelet = new PageletImpl(mainPagelets[0].getModule(), mainPagelets[0].getIdentifier());
    Pagelet imagePagelet = new PageletImpl(mainPagelets[1].getModule(), mainPagelets[1].getIdentifier());

    // Search for pages containing a pagelet (pages 1 and 2)
    SearchQuery q = new SearchQueryImpl(site).withPagelet(titlePagelet);
    assertEquals(2, idx.getByQuery(q).getDocumentCount());

    // Search for pages containing an image pagelet (only page 1)
    q = new SearchQueryImpl(site).withPagelet(imagePagelet);
    assertEquals(1, idx.getByQuery(q).getDocumentCount());
View Full Code Here

   * .
   */
  @Test
  public void testGetWithTemplate() throws Exception {
    populateIndex();
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withTemplate("default");
    assertEquals(1, idx.getByQuery(q).getDocumentCount());
  }
View Full Code Here

   * .
   */
  @Test
  public void testGetWithText() throws Exception {
    populateIndex();
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withFulltext(true, "Technik");
    assertEquals(2, idx.getByQuery(q).getDocumentCount());
  }
View Full Code Here

   * .
   */
  @Test
  public void testGetWithWildcardText() throws Exception {
    populateIndex();
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withFulltext(true, "Techn");
    assertEquals(2, idx.getByQuery(q).getDocumentCount());
  }
View Full Code Here

   */
  @Test
  public void testGetWithAuthor() throws Exception {
    populateIndex();
    User amelie = new UserImpl("amelie");
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withAuthor(amelie);
    SearchResult result = idx.getByQuery(q);
    assertEquals(pages.length, result.getDocumentCount());
    assertEquals(pages.length, result.getDocumentCount());
  }
View Full Code Here

   */
  @Test
  public void testGetWithCreator() throws Exception {
    populateIndex();
    User hans = new UserImpl("hans");
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withCreator(hans);
    SearchResult result = idx.getByQuery(q);
    assertEquals(pages.length, result.getDocumentCount());
    assertEquals(pages.length, result.getDocumentCount());
  }
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.content.SearchQuery

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.