2012-11-01 36 views
1

我在执行下面的查询的浏览器上得到这个错误,但没有“.order(”position“)它工作(但结果很明显没有排序)。Objectify:排序查询结果(“找不到匹配索引”的错误)

Uncaught com.google.web.bindery.event.shared.UmbrellaException: Exception caught: Server Error: no matching index found. 
The suggested index for this query is: 
    <datastore-index kind="Box" ancestor="false" source="manual"> 
     <property name="diagram_id" direction="asc"/> 
     <property name="position" direction="asc"/> 
    </datastore-index> 

BoxDao.java

public List<Box> listFromDiagram(String diagramId) 
{ 
    Objectify ofy = ObjectifyService.begin(); 
    // List of boxes of that diagram ordered by position asc 
    Query<Box> q=ofy.query(Box.class).filter("diagram_id",diagramId).order("position"); 
    List<Box> results = q.list(); 

    return results; 
} 

Box.java

import com.googlecode.objectify.annotation.Entity; 
import com.googlecode.objectify.annotation.Indexed; 

@Entity 
public class Box extends DatastoreObject{ 
    @Indexed private String boxId; 
    @Indexed private String diagram_id; 
    private String title; 
    @Indexed private int position; 
[...] 
} 

文件“datastore-indexes.xml”为空......任何想法?谢谢

回答

相关问题