private Item parseUserInput(QueryType queryType, String defaultIndex, String wordData,
                                Language language, boolean allowNullItem) {
        Parser parser = ParserFactory.newInstance(queryType, environment);
        // perhaps not use already resolved doctypes, but respect source and restrict
        Item item = parser.parse(new Parsable().setQuery(wordData)
                                               .addSources(docTypes)
                                               .setLanguage(language)
                                               .setDefaultIndexName(defaultIndex)).getRoot();
        // the null check should be unnecessary, but is there to avoid having to suppress null warnings
        if ( ! allowNullItem && (item == null || item instanceof NullItem))
            throw new IllegalArgumentException("Parsing '" + wordData + "' only resulted in NullItem.");

        // mark the language used, unless it's the default
        if (language != Language.ENGLISH)
            item.setLanguage(language);

        // userInput should determine the overall language if not set explicitly
        if (userQuery != null && userQuery.getModel().getLanguage() == null)
            userQuery.getModel().setLanguage(language);
        return item;
    }
The YQL query language.

This class <em>must</em> be kept in lockstep with {@link VespaSerializer}.
Adding anything here will usually require a corresponding addition in
VespaSerializer.

@author Steinar Knutsen
@author Stian Kristoffersen
@author Simon Thoresen Hult
container-search/src/main/java/com/yahoo/search/yql/YqlParser.java