Package java.text

Examples of java.text.Collator


    // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
    // RuleBasedCollator. However, the Arabic Locale seems to order the
    // Farsi
    // characters properly.
    Collator c = Collator.getInstance(new Locale("ar"));
    qp.setRangeCollator(c);

    // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
    // orders the U+0698 character before the U+0633 character, so the
    // single
View Full Code Here


    QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "content", new WhitespaceAnalyzer(TEST_VERSION_CURRENT));

    // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
    // RuleBasedCollator.  However, the Arabic Locale seems to order the Farsi
    // characters properly.
    Collator c = Collator.getInstance(new Locale("ar"));
    qp.setRangeCollator(c);

    // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
    // orders the U+0698 character before the U+0633 character, so the single
    // index Term below should NOT be returned by a ConstantScoreRangeQuery
View Full Code Here

  public void testFarsi() throws Exception {
    // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
    // RuleBasedCollator.  However, the Arabic Locale seems to order the Farsi
    // characters properly.
    Collator collator = Collator.getInstance(new Locale("ar"));
    Query query = new TermRangeQuery("content", "\u062F", "\u0698", true, true, collator);
    // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
    // orders the U+0698 character before the U+0633 character, so the single
    // index Term below should NOT be returned by a TermRangeQuery with a Farsi
    // Collator (or an Arabic one for the case when Farsi is not supported).
View Full Code Here

    assertEquals("The index Term should be included.", 1, hits.length);
    searcher.close();
  }
 
  public void testDanish() throws Exception {
    Collator collator = Collator.getInstance(new Locale("da", "dk"));
    // Danish collation orders the words below in the given order (example taken
    // from TestSort.testInternationalSort() ).
    String[] words = { "H\u00D8T", "H\u00C5T", "MAND" };
    Query query = new TermRangeQuery("content", "H\u00D8T", "MAND", false, false, collator);
View Full Code Here

    QueryParser qp = new QueryParser("content", new WhitespaceAnalyzer());

    // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
    // RuleBasedCollator.  However, the Arabic Locale seems to order the Farsi
    // characters properly.
    Collator c = Collator.getInstance(new Locale("ar"));
    qp.setRangeCollator(c);

    // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
    // orders the U+0698 character before the U+0633 character, so the single
    // index Term below should NOT be returned by a ConstantScoreRangeQuery
View Full Code Here

  }
 
  public void testThreadSafe() throws Exception {
    int iters = 20 * RANDOM_MULTIPLIER;
    for (int i = 0; i < iters; i++) {
      Collator collator = Collator.getInstance(Locale.GERMAN);
      collator.setStrength(Collator.PRIMARY);
      assertThreadSafe(new CollationKeyAnalyzer(collator));
    }
  }
View Full Code Here

        "data", "pr*t?j")));
  }

  @Test
  public void testBasicsRngCollating() throws IOException {
    Collator c = Collator.getInstance(Locale.ENGLISH);
    QueryUtils.check(csrq("data", "1", "6", T, T, c));
    QueryUtils.check(csrq("data", "A", "Z", T, T, c));
    QueryUtils.checkUnequal(csrq("data", "1", "6", T, T, c), csrq("data", "A",
        "Z", T, T, c));
  }
View Full Code Here

    assertEquals("num of docs", numDocs, 1 + maxId - minId);

    ScoreDoc[] result;

    Collator c = Collator.getInstance(Locale.ENGLISH);

    // test id, bounded on both ends

    result = search.search(csrq("id", minIP, maxIP, T, T, c), null, numDocs).scoreDocs;
    assertEquals("find all", numDocs, result.length);
View Full Code Here

    assertEquals("num of docs", numDocs, 1 + maxId - minId);

    ScoreDoc[] result;

    Collator c = Collator.getInstance(Locale.ENGLISH);

    // test extremes, bounded on both ends

    result = search.search(csrq("rand", minRP, maxRP, T, T, c), null, numDocs).scoreDocs;
    assertEquals("find all", numDocs, result.length);
View Full Code Here

    IndexSearcher search = newSearcher(reader);

    // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
    // RuleBasedCollator. However, the Arabic Locale seems to order the Farsi
    // characters properly.
    Collator c = Collator.getInstance(new Locale("ar"));

    // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
    // orders the U+0698 character before the U+0633 character, so the single
    // index Term below should NOT be returned by a ConstantScoreRangeQuery
    // with a Farsi Collator (or an Arabic one for the case when Farsi is
View Full Code Here

TOP

Related Classes of java.text.Collator

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.