Java Code Examples for org.apache.lucene.analysis.path.ReversePathHierarchyTokenizer

The following examples show how to use org.apache.lucene.analysis.path.ReversePathHierarchyTokenizer. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public Tokenizer create() {
    if (reverse) {
        return new ReversePathHierarchyTokenizer(bufferSize, delimiter, replacement, skip);
    }
    return new PathHierarchyTokenizer(bufferSize, delimiter, replacement, skip);
}
 
Example 2
Source Project: elasticsearch-analysis-url   Source File: URLTokenizer.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Retrieve tokens representing the host of the given URL
 * @param url URL to be tokenized
 * @param partStringRaw raw (not url decoded) string containing the host
 * @param partString potentially url decoded string containing the host
 * @return host tokens
 * @throws IOException
 */
private List<Token> getHostTokens(String url, String partStringRaw, String partString) throws IOException {
    int start = getStartIndex(url, partStringRaw);
    if (!tokenizeHost || InetAddresses.isInetAddress(partString)) {
        int end = getEndIndex(start, partStringRaw);
        return Collections.singletonList(new Token(partString, URLPart.HOST, start, end));
    }
    return tokenize(URLPart.HOST, addReader(new ReversePathHierarchyTokenizer('.', '.'), new StringReader(partString)), start);
}
 
Example 3
Source Project: crate   Source File: PathHierarchyTokenizerFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Tokenizer create() {
    if (reverse) {
        return new ReversePathHierarchyTokenizer(bufferSize, delimiter, replacement, skip);
    }
    return new PathHierarchyTokenizer(bufferSize, delimiter, replacement, skip);
}