Package org.apache.lucene.facet.taxonomy

Examples of org.apache.lucene.facet.taxonomy.CategoryPath.clear()


        // hence documents), there are no deletions in the index. Therefore, it
        // is sufficient to call next(), and then doc(), exactly once with no
        // 'validation' checks.
        td.seek(t);
        td.next();
        cp.clear();
        cp.add(t.text(), delimiter);
        cache.put(cp, td.doc());
      } while (terms.next());
    }
View Full Code Here


      TermDocs docs = r.termDocs();
      // we call next() first, to skip the root category which always exists.
      while (te.next()) {
        Term term = te.term();
        if (term.field() != Consts.FULL) break;
        cp.clear();
        cp.add(term.text(), Consts.DEFAULT_DELIMITER);
        int ordinal = findCategory(cp);
        if (ordinal < 0) {
          // NOTE: call addCategory so that it works well in a multi-threaded
          // environment, in case e.g. a thread just added the category, after
View Full Code Here

        // hence documents), there are no deletions in the index. Therefore, it
        // is sufficient to call next(), and then doc(), exactly once with no
        // 'validation' checks.
        td.seek(t);
        td.next();
        cp.clear();
        cp.add(t.text(), delimiter);
        cache.put(cp, td.doc());
      } while (terms.next());
    }
View Full Code Here

        // If 'first' is before currentMain, or currentMain is null,
        // then 'first' is a new category and we need to add it to the
        // main taxonomy. Then for all taxonomies with this 'first'
        // category, we need to add the new category number to their
        // map, and move to the next category in all of them.
        cp.clear();
        cp.add(first, delimiter);
        // We can call internalAddCategory() instead of addCategory()
        // because we know the category hasn't been seen yet.
        int newordinal = internalAddCategory(cp, cp.length());
        // TODO (Facet): we already had this term in our hands before, in nextTE...
View Full Code Here

  public void testClear() {
    CategoryPath p = new CategoryPath(0,0);
    p.add("hi");
    p.add("there");
    assertEquals(2, p.length());
    p.clear();
    assertEquals(0, p.length());
    p.add("yo!");
    assertEquals(1, p.length());
  }
View Full Code Here

    // This is (deliberately, in our implementation) indistinguishable
    // from the case of a single empty component:
    p.add("");
    assertEquals("", p.toString('/'));
    // Check just one category (so no delimiter needed):
    p.clear();
    p.add("hello");
    assertEquals("hello", p.toString('/'));
    // Now for two categories:
    p.clear();
    p.add("hello");
View Full Code Here

    // Check just one category (so no delimiter needed):
    p.clear();
    p.add("hello");
    assertEquals("hello", p.toString('/'));
    // Now for two categories:
    p.clear();
    p.add("hello");
    p.add("world");
    assertEquals("hello/world", p.toString('/'));
    // And for a thousand...
    p.clear();
View Full Code Here

    p.clear();
    p.add("hello");
    p.add("world");
    assertEquals("hello/world", p.toString('/'));
    // And for a thousand...
    p.clear();
    p.add("0");
    StringBuilder expected = new StringBuilder("0");
    for (int i=1; i<1000; i++) {
      String num = Integer.toString(i);
      p.add(num);
View Full Code Here

    assertEquals(1, p.length());
    p.add("");
    assertEquals(2, p.length());
    p.add("", '/');
    assertEquals(2, p.length());
    p.clear();
    p.add("", '/');
    assertEquals(0, p.length());
  }
 
  @Test
View Full Code Here

    // the given category, so we do not test this.
    CategoryPath p = new CategoryPath(0, 0);
    p.add("", '/');
    assertEquals(0, p.length());
    assertEquals("", p.toString('@'), "");
    p.clear();
    p.add("hello", '/');
    assertEquals(p.length(), 1);
    assertEquals(p.toString('@'), "hello");
    p.clear();
    p.add("hi/there", '/');
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.