如何使用双引号在 Forge 查看器模型中高效搜索?

How to search in the forge viewer model efficiently using double quotes?

this 博客 post Augusto 表明如果我像下面这样使用双引号

viewer.search('"GRIDPL 2 of GRIDFACES 1 of REFGRD /144CAGRIDS_E3D/WET-END"', (ids)=>{console.log(ids)}, ['Name']);

搜索速度非常快。是的,这是真的。但是当属性名称存储在变量中时,我该如何使用双引号呢? 我尝试了几种方法但没有成功 -

let s = "GRIDPL 2 of GRIDFACES 1 of REFGRD /144CAGRIDS_E3D/WET-END";
viewer.search('\'' + s + '\'', (ids)=>{console.log(ids)}, ['Name']) //[]
viewer.search('\'"' + s + '"\'', (ids)=>{console.log(ids)}, ['Name']) //[]
viewer.search(`'"${s}"'`, (ids)=>{console.log(ids)}, ['Name']) //[]

以上都是空数组,如下图-

你能帮忙吗?

TIA

您错过了最后一个变体,而这正是您需要的:

viewer.search(`"${s}"`, (ids)=>{console.log(ids)}, ['Name'])