List of usage examples for org.apache.lucene.analysis.tokenattributes TypeAttribute DEFAULT_TYPE
String DEFAULT_TYPE
To view the source code for org.apache.lucene.analysis.tokenattributes TypeAttribute DEFAULT_TYPE.
Click Source Link
From source file:com.sindicetech.siren.analysis.TestConciseJsonAnalyzer.java
License:Open Source License
@Test public void testPathEncoding() throws Exception { this.assertAnalyzesTo(_a, "{ \"a\" : [null, \"b\" ] }", new String[] { "a:null", "a:b" }, new String[] { TypeAttribute.DEFAULT_TYPE, TypeAttribute.DEFAULT_TYPE }); this.assertAnalyzesTo(_a, "{ \"a\" : { \"b\" : \"c\" } }", new String[] { "a:", "b:c" }, new String[] { "<LITERAL>", TypeAttribute.DEFAULT_TYPE }); }
From source file:com.sindicetech.siren.analysis.TestConciseJsonAnalyzer.java
License:Open Source License
@Test public void testPathEncodingAttributeWildcardOriginal() throws Exception { final Analyzer literalAnalyzer = new WhitespaceAnalyzer(TEST_VERSION_CURRENT); final Analyzer fieldAnalyzer = new WhitespaceAnalyzer(TEST_VERSION_CURRENT); ConciseJsonAnalyzer analyzer = new ConciseJsonAnalyzer(fieldAnalyzer, literalAnalyzer); analyzer.setGenerateTokensWithoutPath(true); this.assertAnalyzesTo(analyzer, "{ \"a\" : [null, \"b\" ] }", new String[] { "null", "a:null", "b", "a:b" }, new String[] { TypeAttribute.DEFAULT_TYPE, TypeAttribute.DEFAULT_TYPE, TypeAttribute.DEFAULT_TYPE, TypeAttribute.DEFAULT_TYPE }, new int[] { 1, 0, 1, 0 }); this.assertAnalyzesTo(analyzer, "{ \"a\" : { \"b\" : \"c\" } }", new String[] { "a:", "c", "b:c" }, new String[] { "<LITERAL>", TypeAttribute.DEFAULT_TYPE, TypeAttribute.DEFAULT_TYPE }, new int[] { 1, 1, 0 }); }
From source file:com.sindicetech.siren.analysis.TestExtendedJsonAnalyzer.java
License:Open Source License
@Test public void testLiteral() throws Exception { this.assertAnalyzesTo(_a, "{\"foo BAR\":[null,\"FOO bar\"]}", // null is typed as XSD_STRING new String[] { "foo", "BAR", "null", "foo", "bar" }, new String[] { TypeAttribute.DEFAULT_TYPE, TypeAttribute.DEFAULT_TYPE, "<ALPHANUM>", "<ALPHANUM>", "<ALPHANUM>" }); this.assertAnalyzesTo(_a, "{\"ABC\\u0061\\u0062\\u0063\\u00E9\\u00e9ABC\":\"EmptY\"}", new String[] { "ABCabcABC", "empty" }, new String[] { TypeAttribute.DEFAULT_TYPE, "<ALPHANUM>" }); }
From source file:com.sindicetech.siren.analysis.TestExtendedJsonAnalyzer.java
License:Open Source License
@Test public void testLong() throws Exception { _a.registerDatatype(XSDDatatype.XSD_LONG.toCharArray(), new StandardAnalyzer(TEST_VERSION_CURRENT)); this.assertAnalyzesTo(_a, "{\"foo\":12}", new String[] { "foo", "12" }, new String[] { TypeAttribute.DEFAULT_TYPE, "<NUM>" }); }
From source file:com.sindicetech.siren.analysis.TestExtendedJsonAnalyzer.java
License:Open Source License
@Test public void testDouble() throws Exception { _a.registerDatatype(XSDDatatype.XSD_DOUBLE.toCharArray(), new StandardAnalyzer(TEST_VERSION_CURRENT)); this.assertAnalyzesTo(_a, "{\"foo\":12.42}", new String[] { "foo", "12.42" }, new String[] { TypeAttribute.DEFAULT_TYPE, "<NUM>" }); }
From source file:com.sindicetech.siren.analysis.TestExtendedJsonAnalyzer.java
License:Open Source License
@Test public void testBoolean() throws Exception { _a.registerDatatype(XSDDatatype.XSD_BOOLEAN.toCharArray(), new WhitespaceAnalyzer(TEST_VERSION_CURRENT)); this.assertAnalyzesTo(_a, "{\"foo\":[true,false]}", new String[] { "foo", "true", "false" }, new String[] { TypeAttribute.DEFAULT_TYPE, TypeAttribute.DEFAULT_TYPE, TypeAttribute.DEFAULT_TYPE }); }