Package org.elasticsearch.index.analysis

Examples of org.elasticsearch.index.analysis.NamedAnalyzer.tokenStream()


    @Test
    public void testCanUseFromNamedAnalyzer() throws IOException {
        ComboAnalyzer cb = new ComboAnalyzer(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
        NamedAnalyzer namedAnalyzer = new NamedAnalyzer("name", AnalyzerScope.INDEX, cb);
        for (int i = 0 ; i < 3 ; i++)
            assertTokenStreamContents(namedAnalyzer.tokenStream("field", new StringReader("just a little test " + i)),
                    new String[]{"just", "a", "little", "test", Integer.toString(i)},
                    new int[]{ 057, 14, 19},
                    new int[]{ 46, 13, 18, 20},
                    new int[]{ 11111});
    }
View Full Code Here


                        // Serialize runs
                        lock.lock();
                        // Get unique sequence number
                        int i = sequence.getAndIncrement();
                        // Check the analysis went well, including the unique sequence number
                        assertTokenStreamContents(namedAnalyzer.tokenStream("field", new StringReader("just a little test " + i)),
                                new String[]{"just", "a", "little", "test", Integer.toString(i)},
                                new int[]{0, 5, 7, 14, 19},
                                new int[]{4, 6, 13, 18, 19 + ("" + i).length()},
                                new int[]{1, 1, 1, 1, 1});
                    } catch (Exception e) {
View Full Code Here

                    // Run multiple times before quitting
                    for (int run = 0 ; run < runs ; ++run) {
                        // Get unique sequence number
                        int i = sequence.getAndIncrement();
                        // Check the analysis went well, including the unique sequence number
                        assertTokenStreamContents(namedAnalyzer.tokenStream("field", new StringReader("just a little test " + i)),
                                new String[]{"just", "a", "little", "test", Integer.toString(i)},
                                new int[]{0, 5, 7, 14, 19},
                                new int[]{4, 6, 13, 18, 19 + ("" + i).length()},
                                new int[]{1, 1, 1, 1, 1});
                    }
View Full Code Here

    public void testMorphologyAnalysis() throws Exception {
        AnalysisService analysisService = getAnalysisService();

        NamedAnalyzer russianAnalyzer = analysisService.analyzer("russian_morphology");
        MatcherAssert.assertThat(russianAnalyzer.analyzer(), instanceOf(RussianAnalyzer.class));
        assertSimpleTSOutput(russianAnalyzer.tokenStream("test", new StringReader("тест")), new String[] {"тест", "тесто"});

        NamedAnalyzer englishAnalyzer = analysisService.analyzer("english_morphology");
        MatcherAssert.assertThat(englishAnalyzer.analyzer(), instanceOf(EnglishAnalyzer.class));
        assertSimpleTSOutput(englishAnalyzer.tokenStream("test", new StringReader("gone")), new String[]{"gone", "go"});
    }
View Full Code Here

        MatcherAssert.assertThat(russianAnalyzer.analyzer(), instanceOf(RussianAnalyzer.class));
        assertSimpleTSOutput(russianAnalyzer.tokenStream("test", new StringReader("тест")), new String[] {"тест", "тесто"});

        NamedAnalyzer englishAnalyzer = analysisService.analyzer("english_morphology");
        MatcherAssert.assertThat(englishAnalyzer.analyzer(), instanceOf(EnglishAnalyzer.class));
        assertSimpleTSOutput(englishAnalyzer.tokenStream("test", new StringReader("gone")), new String[]{"gone", "go"});
    }

    @Test
    public void testPm() throws Exception {
        LuceneMorphology russianLuceneMorphology = new RussianLuceneMorphology();
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.