我们本质上是在尝试构建动态过滤系统。您可以在构面中键入值以按该构面和构面值进行过滤。
例如,输入' P'。我不希望所有的对象都在字母“P'存在。相反,我希望所有的Facets都能在P' P'以分面价值存在。
因此使用下图作为示例Facets。输入' P'我想要归还类似的东西。
private void createStage() {
stage = new Stage();
intervalTime = 15L;
buttonLeft = new TextButton("", leftStyle);
buttonLeft.addListener(new InputListener() {
// repeat an action with ScheduledExecutorService
final Runnable leftRunnable = new Runnable() {
@Override
public void run() {
Vector3 dir = new Vector3();
dir.fromString(cam.direction.toString()).scl(0.5f);
cam.position.add(dir.z, 0, -dir.x); // camera moves to left
cam.update();
}
};
// add on thread to object
final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
ScheduledFuture<?> future; // future schedule to run and stop task
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
future = executor.scheduleAtFixedRate(leftRunnable, 0L, intervalTime, TimeUnit.MILLISECONDS);
return true;
}
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
super.touchUp(event, x, y, pointer, button);
//leftFlag = false;
if (future != null) {
future.cancel(true);
}
}
});
答案 0 :(得分:0)
您可以使用searchForFacetValues()
搜索构面值:
index.searchForFacetValues({
facetName: 'category',
facetQuery: 'phone'
})