Package com.flaptor.indextank.query

Examples of com.flaptor.indextank.query.AToken


      Iterator<AToken> tokens = parser.parseDocumentField(field, document.getField(field));
      SortedSetMultimap<String, Integer> termPositions = TreeMultimap.create();
      int tokenCount = 0;
      while (tokens.hasNext()) {
        tokenCount++;
        AToken token = tokens.next();
        termPositions.put(token.getText(), token.getPosition());
      }
       
      for (String term : termPositions.keySet()) {
        Key key = new Key(field, term);
        SortedSet<Integer> positionsSet = termPositions.get(term);
View Full Code Here


        index.dump();
    }

    public List<String> complete(String partialQuery, String field) {
        Iterator<AToken> it = parser.parseDocumentField(field, partialQuery);
        AToken lastToken = null;
        while (it.hasNext()) {
            lastToken = it.next();
        }
       
        if (lastToken == null) {
            return Collections.emptyList();
        } else {
            List<String> popularTerms = index.getMostPopular(field + ":" + lastToken.getText());
            if (null == popularTerms) {
                return Collections.emptyList();
            } else {
                int start = lastToken.getStartOffset();
                String prefix = partialQuery.substring(0, start);
                List<String> suggestions = new ArrayList<String>(popularTerms.size());
                for (String term : popularTerms) {
                  term = term.substring(field.length() + 1);
                    suggestions.add(prefix + term);
View Full Code Here

    }

    private void addContent(String fieldName, String content) {
        Iterator<AToken> it = parser.parseDocumentField(fieldName, content);
        while (it.hasNext()) {
            AToken token = it.next();
            index.addTerm(fieldName + ":" + token.getText());
        }
    }
View Full Code Here

TOP

Related Classes of com.flaptor.indextank.query.AToken

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.