Package org.apache.lucene.analysis

Examples of org.apache.lucene.analysis.TokenStream.addAttribute()


            throws IOException {

        TokenStream stream = analyzer.tokenStream("contents",
                new StringReader(text));

        CharTermAttribute term = stream.addAttribute(CharTermAttribute.class);
        PositionIncrementAttribute posIncr = stream
                .addAttribute(PositionIncrementAttribute.class);
        OffsetAttribute offset = stream.addAttribute(OffsetAttribute.class);
        TypeAttribute type = stream.addAttribute(TypeAttribute.class);
        PayloadAttribute payload = stream.addAttribute(PayloadAttribute.class);
View Full Code Here


        TokenStream stream = analyzer.tokenStream("contents",
                new StringReader(text));

        CharTermAttribute term = stream.addAttribute(CharTermAttribute.class);
        PositionIncrementAttribute posIncr = stream
                .addAttribute(PositionIncrementAttribute.class);
        OffsetAttribute offset = stream.addAttribute(OffsetAttribute.class);
        TypeAttribute type = stream.addAttribute(TypeAttribute.class);
        PayloadAttribute payload = stream.addAttribute(PayloadAttribute.class);
View Full Code Here

                new StringReader(text));

        CharTermAttribute term = stream.addAttribute(CharTermAttribute.class);
        PositionIncrementAttribute posIncr = stream
                .addAttribute(PositionIncrementAttribute.class);
        OffsetAttribute offset = stream.addAttribute(OffsetAttribute.class);
        TypeAttribute type = stream.addAttribute(TypeAttribute.class);
        PayloadAttribute payload = stream.addAttribute(PayloadAttribute.class);

        int position = 0;
        while (stream.incrementToken()) {
View Full Code Here

        CharTermAttribute term = stream.addAttribute(CharTermAttribute.class);
        PositionIncrementAttribute posIncr = stream
                .addAttribute(PositionIncrementAttribute.class);
        OffsetAttribute offset = stream.addAttribute(OffsetAttribute.class);
        TypeAttribute type = stream.addAttribute(TypeAttribute.class);
        PayloadAttribute payload = stream.addAttribute(PayloadAttribute.class);

        int position = 0;
        while (stream.incrementToken()) {
View Full Code Here

        CharTermAttribute term = stream.addAttribute(CharTermAttribute.class);
        PositionIncrementAttribute posIncr = stream
                .addAttribute(PositionIncrementAttribute.class);
        OffsetAttribute offset = stream.addAttribute(OffsetAttribute.class);
        TypeAttribute type = stream.addAttribute(TypeAttribute.class);
        PayloadAttribute payload = stream.addAttribute(PayloadAttribute.class);

        int position = 0;
        while (stream.incrementToken()) {

            int increment = posIncr.getPositionIncrement();
View Full Code Here

    config.set("pattern", "\\s+");
    config.set("lowercase", "false");
    CustomPatternAnalyzer a = new CustomPatternAnalyzer(config);
   
    TokenStream tokenStream = a.tokenStream("test", "this is a Text with Whitespaces");
    CharTermAttribute charTermAttribute = tokenStream.addAttribute(CharTermAttribute.class);

    tokenStream.incrementToken();
    String t2 = charTermAttribute.toString();
    tokenStream.incrementToken();
    String t3 = charTermAttribute.toString();
View Full Code Here

    config.set("pattern", "\\s+");
    config.set("lowercase", "true");
    CustomPatternAnalyzer a = new CustomPatternAnalyzer(config);
   
    TokenStream tokenStream = a.tokenStream("test", "this is a Text with Whitespaces");
    CharTermAttribute charTermAttribute = tokenStream.addAttribute(CharTermAttribute.class);

    tokenStream.incrementToken();
    String t2 = charTermAttribute.toString();
    tokenStream.incrementToken();
    String t3 = charTermAttribute.toString();
View Full Code Here

    GenericConfiguration config = new GenericConfiguration();
    config.set("pattern", "\\s+");
    CustomPatternAnalyzer a = new CustomPatternAnalyzer(config);
   
    TokenStream tokenStream = a.tokenStream("test", "this is a Text with Whitespaces");
    CharTermAttribute charTermAttribute = tokenStream.addAttribute(CharTermAttribute.class);

    tokenStream.incrementToken();
    String t2 = charTermAttribute.toString();
    tokenStream.incrementToken();
    String t3 = charTermAttribute.toString();
View Full Code Here

        List<String> tokens = new ArrayList<String>();
        TokenStream stream = null;
        try {
            stream = analyzer.tokenStream(FieldNames.FULLTEXT,
                    new StringReader(text));
            CharTermAttribute termAtt = stream
                    .addAttribute(CharTermAttribute.class);
            OffsetAttribute offsetAtt = stream
                    .addAttribute(OffsetAttribute.class);
            // TypeAttribute type = stream.addAttribute(TypeAttribute.class);
View Full Code Here

        try {
            stream = analyzer.tokenStream(FieldNames.FULLTEXT,
                    new StringReader(text));
            CharTermAttribute termAtt = stream
                    .addAttribute(CharTermAttribute.class);
            OffsetAttribute offsetAtt = stream
                    .addAttribute(OffsetAttribute.class);
            // TypeAttribute type = stream.addAttribute(TypeAttribute.class);

            stream.reset();
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.