Package org.exist.xquery.modules.ngram.query

Examples of org.exist.xquery.modules.ngram.query.Wildcard


        if (queryTokens.isEmpty())
            return new EmptyExpression();

        for (String token : queryTokens) {
            if (token.startsWith(".")) {
                Wildcard wildcard = null;
                if (token.length() == 1) {
                    wildcard = new Wildcard(1, 1);
            } else {
                    String qualifier = token.substring(1);
                    if (qualifier.equals("?"))
                        wildcard = new Wildcard(0, 1);
                    else if (qualifier.equals("*"))
                        wildcard = new Wildcard(0, Integer.MAX_VALUE);
                    else if (qualifier.equals("+"))
                        wildcard = new Wildcard(1, Integer.MAX_VALUE);
                    else {
                        Pattern p = Pattern.compile(INTERVAL_QUALIFIER_PATTERN);
                        Matcher m = p.matcher(qualifier);
                        if (!m.matches()) // Should not happen
                            throw new XPathException(
                            this,
                            ErrorCodes.FTDY0020,
                            "query string violates wildcard qualifier syntax"
                        );
                        try {
                          wildcard = new Wildcard(Integer.parseInt(m.group(1)), Integer.parseInt(m.group(2)));
                        } catch (NumberFormatException nfe) {
                            throw new XPathException(this,
                            ErrorCodes.FTDY0020,
                            "query string violates wildcard qualifier syntax",
                            new StringValue(query),
View Full Code Here

TOP

Related Classes of org.exist.xquery.modules.ngram.query.Wildcard

Copyright © 2018 www.massapicom. 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.