class SchemaIndexTransaction extends AbstractTransaction {

    public SchemaIndexTransaction(HugeGraphParams graph, BackendStore store) {
        super(graph, store);
    }

    @Watched(prefix = "index")
    public void updateNameIndex(SchemaElement element, boolean removed) {
        if (!this.needIndexForName()) {
            return;
        }

        IndexLabel indexLabel = IndexLabel.label(element.type());
        // Update name index if backend store not supports name-query
        HugeIndex index = new HugeIndex(this.graph(), indexLabel);
        index.fieldValues(element.name());
        index.elementIds(element.id());

        if (removed) {
            this.doEliminate(this.serializer.writeIndex(index));
        } else {
            this.doAppend(this.serializer.writeIndex(index));
        }
    }

    private boolean needIndexForName() {
        return !this.store().features().supportsQuerySchemaByName();
    }

    @Watched(prefix = "index")
    @Override
    public QueryResults<BackendEntry> query(Query query) {
        if (query instanceof ConditionQuery) {
            ConditionQuery q = (ConditionQuery) query;
            if (q.allSysprop() && q.conditionsSize() == 1 &&
                q.containsCondition(HugeKeys.NAME)) {
                return this.queryByName(q);
            }
        }
        return super.query(query);
    }

    @Watched(prefix = "index")
    private QueryResults<BackendEntry> queryByName(ConditionQuery query) {<FILL_FUNCTION_BODY>}
}

        if (!this.needIndexForName()) {
            return super.query(query);
        }
        IndexLabel il = IndexLabel.label(query.resultType());
        String name = query.condition(HugeKeys.NAME);
        E.checkState(name != null, "The name in condition can't be null " +
                                   "when querying schema by name");

        ConditionQuery indexQuery;
        indexQuery = new ConditionQuery(HugeType.SECONDARY_INDEX, query);
        indexQuery.eq(HugeKeys.FIELD_VALUES, name);
        indexQuery.eq(HugeKeys.INDEX_LABEL_ID, il.id());

        IdQuery idQuery = new IdQuery(query.resultType(), query);
        Iterator<BackendEntry> entries = super.query(indexQuery).iterator();
        try {
            while (entries.hasNext()) {
                HugeIndex index = this.serializer.readIndex(graph(), indexQuery,
                                                            entries.next());
                idQuery.query(index.elementIds());
                Query.checkForceCapacity(idQuery.idsSize());
            }
        } finally {
            CloseableIterator.closeIterator(entries);
        }

        if (idQuery.ids().isEmpty()) {
            return QueryResults.empty();
        }

        assert idQuery.idsSize() == 1 : idQuery.ids();
        if (idQuery.idsSize() > 1) {
            LOG.warn("Multiple ids are found with same name '{}': {}",
                     name, idQuery.ids());
        }
        return super.query(idQuery);
    
<methods>public void <init>(org.apache.hugegraph.HugeGraphParams, org.apache.hugegraph.backend.store.BackendStore) ,public boolean autoCommit() ,public void close() ,public void commit() throws org.apache.hugegraph.backend.BackendException,public void commitIfGtSize(int) throws org.apache.hugegraph.backend.BackendException,public void commitOrRollback() ,public void doAppend(org.apache.hugegraph.backend.store.BackendEntry) ,public void doEliminate(org.apache.hugegraph.backend.store.BackendEntry) ,public void doInsert(org.apache.hugegraph.backend.store.BackendEntry) ,public void doRemove(org.apache.hugegraph.backend.store.BackendEntry) ,public void doUpdateIfAbsent(org.apache.hugegraph.backend.store.BackendEntry) ,public void doUpdateIfPresent(org.apache.hugegraph.backend.store.BackendEntry) ,public org.apache.hugegraph.backend.store.BackendEntry get(org.apache.hugegraph.type.HugeType, org.apache.hugegraph.backend.id.Id) ,public org.apache.hugegraph.HugeGraph graph() ,public org.apache.hugegraph.type.define.GraphMode graphMode() ,public java.lang.String graphName() ,public boolean hasUpdate() ,public boolean hasUpdate(org.apache.hugegraph.type.HugeType, org.apache.hugegraph.type.define.Action) ,public transient R metadata(org.apache.hugegraph.type.HugeType, java.lang.String, java.lang.Object[]) ,public int mutationSize() ,public QueryResults<org.apache.hugegraph.backend.store.BackendEntry> query(org.apache.hugegraph.backend.query.Query) ,public org.apache.hugegraph.backend.store.BackendEntry query(org.apache.hugegraph.type.HugeType, org.apache.hugegraph.backend.id.Id) ,public java.lang.Number queryNumber(org.apache.hugegraph.backend.query.Query) ,public void rollback() throws org.apache.hugegraph.backend.BackendException,public org.apache.hugegraph.backend.store.BackendFeatures storeFeatures() ,public boolean storeInitialized() <variables>protected static final Logger LOG,private boolean autoCommit,private boolean closed,private boolean committing,private boolean committing2Backend,private final non-sealed org.apache.hugegraph.HugeGraphParams graph,private org.apache.hugegraph.backend.store.BackendMutation mutation,private final java.lang.Thread ownerThread,protected final non-sealed org.apache.hugegraph.backend.serializer.AbstractSerializer serializer,private final non-sealed org.apache.hugegraph.backend.store.BackendStore store