code: public static Query createQuery(QueryRootNode root, SessionImpl session, ItemDataConsumer sharedItemMgr,
        NamespaceMappings nsMappings, Analyzer analyzer, PropertyTypeRegistry propReg, SynonymProvider synonymProvider,
        IndexFormatVersion indexFormatVersion, VirtualTableResolver<Query> virtualTableResolver,
        IndexingConfiguration indexConfig) throws RepositoryException
     {
  
        LuceneQueryBuilder builder =
           new LuceneQueryBuilder(root, session, sharedItemMgr, nsMappings, analyzer, propReg, synonymProvider,
              indexFormatVersion, virtualTableResolver, indexConfig);
  
        Query q = builder.createLuceneQuery();
        if (builder.exceptions.size() > 0)
        {
           StringBuilder msg = new StringBuilder();
           for (Iterator<Exception> it = builder.exceptions.iterator(); it.hasNext();)
           {
              msg.append(it.next().toString()).append('\n');
           }
           throw new RepositoryException("Exception building query: " + msg.toString());
        }
        return q;
     }
docs: Creates a lucene {@link org.apache.lucene.search.Query} tree from an
  abstract query tree.
  
  @param root
  the root node of the abstract query tree.
  @param session
  of the user executing the query.
  @param sharedItemMgr
  the shared item state manager of the workspace.
  @param nsMappings
  namespace resolver for internal prefixes.
  @param analyzer
  for parsing the query statement of the contains function.
  @param propReg
  the property type registry to lookup type information.
  @param synonymProvider
  the synonym provider or <code>null</code> if node is
  configured.
  @param indexFormatVersion
  the index format version to be used
  @return the lucene query tree.
  @throws RepositoryException
  if an error occurs during the translation.