Examples of Collator


Examples of java.text.Collator

        "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

Examples of java.text.Collator

    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

Examples of java.text.Collator

    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

Examples of java.text.Collator

    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

Examples of java.text.Collator

    IndexReader reader = writer.getReader();
    writer.close();

    IndexSearcher search = newSearcher(reader);

    Collator c = Collator.getInstance(new Locale("da", "dk"));

    // Unicode order would not include "H\u00C5T" in [ "H\u00D8T", "MAND" ],
    // but Danish collation does.
    ScoreDoc[] result = search.search
      (csrq("content", "H\u00D8T", "MAND", F, F, c), null, 1000).scoreDocs;
View Full Code Here

Examples of java.text.Collator

        }
    }

    public int compare( String content, String facetValue ){
        Locale    loc       = Locale.getDefault();
        Collator  collator  = Collator.getInstance( loc );
        return collator.compare( content, facetValue );
    }
View Full Code Here

Examples of java.text.Collator

            {
                // For now, create and configure a collator instance. I can't
                // actually imagine that this'd be slower than caching them
                // a la ClassCache, so we aren't trying to outsmart ourselves
                // with a caching mechanism for now.
                Collator collator = Collator.getInstance(cx.getLocale());
                collator.setStrength(Collator.IDENTICAL);
                collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
                return ScriptRuntime.wrapNumber(collator.compare(
                        ScriptRuntime.toString(thisObj),
                        ScriptRuntime.toString(args, 0)));
            }
            case Id_toLocaleLowerCase:
            {
View Full Code Here

Examples of java.text.Collator

            assertEquals(i, coll.getDecomposition());
        }
    }

    public void testCollator_GetInstance() {
        Collator coll = Collator.getInstance();
        Object obj1 = "a";
        Object obj2 = "b";
        assertEquals(-1, coll.compare(obj1, obj2));

        Collator.getInstance();
        assertFalse(coll.equals("A", "\uFF21"));
    }
View Full Code Here

Examples of java.text.Collator

        // }
    }

    // Test CollationKey
    public void testCollationKey() {
        Collator coll = Collator.getInstance(Locale.US);
        String text = "abc";
        CollationKey key = coll.getCollationKey(text);
        key.hashCode();

        CollationKey key2 = coll.getCollationKey("abc");

        assertEquals(0, key.compareTo(key2));
    }
View Full Code Here

Examples of java.text.Collator

        // Regression for Harmony-1066
        assertTrue(head instanceof Serializable);

        // Regression for ill-behaved collator
        Collator c = new Collator() {
            @Override
            public int compare(String o1, String o2) {
                if (o1 == null) {
                    return 0;
                }
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.