code: public static Query createMatchAllQuery(String name, IndexFormatVersion version)
     {
        if (version.getVersion() >= IndexFormatVersion.V2.getVersion())
        {
           // new index format style
           return new JcrTermQuery(new Term(FieldNames.PROPERTIES_SET, name));
        }
        else
        {
           return new MatchAllQuery(name);
        }
     }
docs: Depending on the index format this method returns a query that matches
  all nodes that have a property with a given <code>name</code>.
  
  @param name    the property name.
  @param version the index format version.
  @return Query that matches all nodes that have a property with the given
  <code>name</code>.