Returns a startswith query on the un-stemmed term.

        Assumes term is not a list.
328789
def _filter_startswith(self, term, field_name, field_type, is_not):
        
        if field_type == 'text':
            if len(term.split()) == 1:
                term = '^ %s*' % term
                query = self.backend.parse_query(term)
            else:
                term = '^ %s' % term
                query = self._phrase_query(term.split(), field_name, field_type)
        else:
            term = '^%s*' % term
            query = self.backend.parse_query(term)

        if is_not:
            return xapian.Query(xapian.Query.OP_AND_NOT, self._all_query(), query)
        return query
603624
def ls(self, startswith=None):
        '''
        
        '''
        logger.info('Listing cubes starting with "%s")' % startswith)
        startswith = unicode(startswith or '')
        tables = sorted(name for name in self.db_tables
                        if name.startswith(startswith))
        return tables
289119
public BooleanExpression startsWith(Expression<String> str) {
        return Expressions.booleanOperation(Ops.STARTS_WITH, mixin, str);
    }
942974
def start_with(prefix, beg, len)
      s = @s
      c = @cur
      if @len - c < len
        return false
      end
      word = s.unpack("U*")[c]
      if word.nil?
        return (prefix.slice(beg, len-beg) == nil)
      else
        [word].pack("U*").starts_with?(prefix.slice(beg, len-beg))
      end
    end
783357
public static <I, D> List<Word<I>> findMalerPnueli(Query<I, D> ceQuery) {
        return ceQuery.getInput().suffixes(false);
    }
1135637
public List<int[]> commonPrefixSearch(String query, int start)
    {
        List<int[]> ret = new ArrayList<int[]>(5);
        if ((query == null) || (start >= query.length()))
        {
            return ret;
        }
        int curState = 1;
        for (int i = start; i < query.length(); i++)
        {
            int[] res = transferValues(curState, query.charAt(i));
            if (res[0] == -1)
            {
                break;
            }
            curState = res[0];
            if (res[1] != -1)
            {
                ret.add(new int[]{i - start + 1, res[1]});
            }
        }
        return ret;
    }
17172
def _query_from_term(self, term, field_name, filter_type, is_not):
        
        if field_name != 'content' and field_name not in self.backend.column:
            raise InvalidIndexError('field "%s" not indexed' % field_name)

        # It it is an AutoQuery, it has no filters
        # or others, thus we short-circuit the procedure.
        if isinstance(term, AutoQuery):
            if field_name != 'content':
                query = '%s:%s' % (field_name, term.prepare(self))
            else:
                query = term.prepare(self)
            return [self.backend.parse_query(query)]
        query_list = []

        # Handle `ValuesListQuerySet`.
        if hasattr(term, 'values_list'):
            term = list(term)

        if field_name == 'content':
            # content is the generic search:
            # force no field_name search
            # and the field_type to be 'text'.
            field_name = None
            field_type = 'text'

            # we don't know what is the type(term), so we parse it.
            # Ideally this would not be required, but
            # some filters currently depend on the term to make decisions.
            term = _to_xapian_term(term)

            query_list.append(self._filter_contains(term, field_name, field_type, is_not))
            # when filter has no filter_type, haystack uses
            # filter_type = 'content'. Here we remove it
            # since the above query is already doing this
            if filter_type == 'content':
                filter_type = None
        else:
            # get the field_type from the backend
            field_type = self.backend.schema[self.backend.column[field_name]]['type']

        # private fields don't accept 'contains' or 'startswith'
        # since they have no meaning.
        if filter_type in ('contains', 'startswith') and field_name in (ID, DJANGO_ID, DJANGO_CT):
            filter_type = 'exact'

        if field_type == 'text':
            # we don't know what type "term" is, but we know we are searching as text
            # so we parse it like that.
            # Ideally this would not be required since _term_query does it, but
            # some filters currently depend on the term to make decisions.
            if isinstance(term, list):
                term = [_to_xapian_term(term) for term in term]
            else:
                term = _to_xapian_term(term)

        # todo: we should check that the filter is valid for this field_type or raise InvalidIndexError
        if filter_type == 'contains':
            query_list.append(self._filter_contains(term, field_name, field_type, is_not))
        elif filter_type in ('content', 'exact'):
            query_list.append(self._filter_exact(term, field_name, field_type, is_not))
        elif filter_type == 'in':
            query_list.append(self._filter_in(term, field_name, field_type, is_not))
        elif filter_type == 'startswith':
            query_list.append(self._filter_startswith(term, field_name, field_type, is_not))
        elif filter_type == 'endswith':
            raise NotImplementedError("The Xapian search backend doesn't support endswith queries.")
        elif filter_type == 'gt':
            query_list.append(self._filter_gt(term, field_name, field_type, is_not))
        elif filter_type == 'gte':
            query_list.append(self._filter_gte(term, field_name, field_type, is_not))
        elif filter_type == 'lt':
            query_list.append(self._filter_lt(term, field_name, field_type, is_not))
        elif filter_type == 'lte':
            query_list.append(self._filter_lte(term, field_name, field_type, is_not))
        elif filter_type == 'range':
            query_list.append(self._filter_range(term, field_name, field_type, is_not))
        return query_list
582224
def _first(self, query):
        """"""
        result = query.first()
        if result is None:
            raise NotFoundError
        else:
            if result.has_expired(self._expirations):
                raise NotFoundError
            return result
385807
public Criteria startsWith(String s) {
		assertNoBlankInWildcardedQuery(s, false, true);
		predicates.add(new Predicate(OperationKey.STARTS_WITH, s));
		return this;

	}
747822
function startsWithAny(string, vector) {
  return _.any(vector.map(function (e) { return _str.startsWith(string, e); }));
}
1173593
def query(options, collection_name, num_to_skip, num_to_return,
          query, field_selector, opts, check_keys=False, ctx=None):
    """"""
    if ctx:
        return _query_compressed(options, collection_name, num_to_skip,
                                 num_to_return, query, field_selector,
                                 opts, check_keys, ctx)
    return _query_uncompressed(options, collection_name, num_to_skip,
                               num_to_return, query, field_selector, opts,
                               check_keys)
1288041
def query_term(term)
      # rubocop:disable Style/GuardClause
      if term.is_a?(Symbol)
        return term.to_s
      elsif term.is_a?(Integer)
        return term
      elsif term.is_a?(TrueClass)
        return term
      elsif !term.is_a?(Term)
        return "'#{term}'"
      end
      # rubocop:enable Style/GuardClause
      terms = term.args.map { |t| query_term(t) }
      case term.operator.symbol
      when :_and
        { :$and => terms }
      when :_or
        { :$or => terms }
      when :_not
        # $not currently (<=2.5.1) only supports negating equality operators.
        # so you can do { field: { $not : { [$eq,$gt,$lt,...] } }
        # but there is no way to negate an entire expression.
        # see https://jira.mongodb.org/browse/SERVER-10708
        { :$nor => terms }
      when :_equal
        { term.args[0] => stringify(term.args[1]) }
      when :_not_equal
        { term.args[0] => { :$ne => stringify(term.args[1]) } }
      when :_match
        { term.args[0] => { :$regex => term.args[1].to_s } }
      when :_in
        { term.args[0] => { :$in => term.args[1] } }
      when :_greater
        { term.args[0] => { :$gt => term.args[1] } }
      when :_greater_or_equal
        { term.args[0] => { :$gte => term.args[1] } }
      when :_less
        { term.args[0] => { :$lt => term.args[1] } }
      when :_less_or_equal
        { term.args[0] => { :$lte => term.args[1] } }
      else
        raise "can't handle operator '#{term.operator}' yet"
      end
    end
1278106
def StartsWithIgnoreCase(self, value):
    
    self._awql = self._CreateSingleValueCondition(value,
                                                  'STARTS_WITH_IGNORE_CASE')
    return self._query_builder
811694
function(str) {
    var startsWith = !_.isNull(str.match(pOpsHeadRe))
    return startsWith & cons.isLegalSentence(str)
  }
251889
function getMatchedWord(sWords, sTokenToMatch) {
		if (sWords) {

			var fnStartsWithToken = function (sString) {
				return sString.toLowerCase().indexOf(sTokenToMatch.toLowerCase()) === 0;
			};

			var aMetadataTokens = sWords.split(" ");
			// note we search words that *start with* the token to match
			// rather than *exact* match only, because the user may have entered only the beginning of the word;
			// and Lunr supports search by the *beginning* of the word (but not by substring other than the beginning)
			var sMatchedMetadataToken = aMetadataTokens.filter(fnStartsWithToken);
			if (sMatchedMetadataToken.length) {
				return sMatchedMetadataToken[0];
			}
		}
		return null;
	}
1054512
def word_starts(self):
        """"""
        if not self.is_tagged(WORDS):
            self.tokenize_words()
        return self.starts(WORDS)
488523
def unstem(self, term):

        

        originals = []
        for i in self.terms[term]:
            originals.append(self.tokens[i]['unstemmed'])

        mode = Counter(originals).most_common(1)
        return mode[0][0]