Database db = Factory.getSession().getCurrentDatabase();
View view = db.getView("people");
//Returns the total number of entries e.g. 100
System.out.println( view.getEntryCount() );
//Filters the view so it represents only those documents that match the query
view.FTSearch("[lasteName] = \"Lynn\"");
//Returns the correct filtered number e.g. 30
System.out.println( view.getEntryCount() );
//Create a ViewNavigator based on the filtered view.
ViewNavigator nav = view.createViewNav();
//Unfortunately, it returns the original 100 instead of 30
System.out.println( nav.getCount() );
上面的示例说明,在过滤(FTSearched)视图上创建ViewNavigator实例时,将使用原始视图数据,而不是过滤后的视图数据。谁能解释为什么会这样?或澄清一些(基本)潜在机制?
答案 0 :(得分:1)
不要使用viewnavigator,过滤视图,然后使用getAllEntries()获取ViewEntryCollection
霍华德