GAS创建的文档未在搜索结果中返回

时间:2012-09-12 21:58:27

标签: google-apps-script

我编写了一个脚本,将我公司旧文档系统中的文档转换为Google Drive作为Google文档。但是,在“我的云端硬盘”中搜索我知道在这些文档中的单词时,它们不会返回到结果列表中。如果我打开其中一个文档并对其进行编辑,则可能会在将来的搜索中返回。

我已经能够用一个小脚本重现这个

function newDoc() {
  var title = "Document Search Testing ";
  var txt = "You can't handle the truth! Son, we live in a world that has walls, and those walls have to be guarded by men with guns. Who's gonna do it? You? You, Lieutenant Weinberg? I have a greater responsibility than you can possibly fathom! You weep for Santiago and you curse the Marines. You have that luxury. You have the luxury of not knowing what I know: that Santiago's death, while tragic, probably saved lives. And my existence, while grotesque and incomprehensible to you, saves lives! You don't want the truth, because deep down in places you don't talk about at parties, you want me on that wall! You need me on that wall! We use words like honor, code, loyalty. We use these words as the backbone of a life spent defending something. You use them as a punchline! I have neither the time nor the inclination to explain myself to a man who rises and sleeps under the blanket of the very freedom that I provide, and then questions the manner in which I provide it! I would rather you just said Thank you, and went on your way. Otherwise, I suggest you pick up a weapon, and stand a post. Either way, I don't give a damn what you think you are entitled to!";
  for (i=0; i<3; i++) {
    var doc = DocumentApp.create(title + i);
    doc.appendParagraph(txt);
    doc.appendParagraph(" ");
    doc.appendParagraph("the end");
    doc.saveAndClose();
  }
  "done";
}

然后我还手动创建了一个名为“文档搜索测试手册”的文档,并将相同的电影引号粘贴到其中。然后,我使用搜索词“武器”搜索了我的云端硬盘,并收到了以下结果:

9/11@10:47 Created via script
  Document Search Testing 0
  Document Search Testing 1
  Document Search Testing 2
9/11@10:50 manually created (copied text)
  Document Search Testing Manual
9/11@10:52 searched on 'weapon', only hit is the script document
9/11@11:38 searched on 'weapon', receive hits for the script itself and the manual document none of the script created ones
9/11@14:00 searched on 'weapon', hits for the script and the manual document only
9/12@10:00 searched on 'weapon', hits for the script and the manual document only
9/12@10:01 opened 'Document Search Testing 0', clicked around in document, made no changes, closed document
9/12@10:02 opened 'Document Search Testing 1', added a line to the first paragraph, closed document
9/12@10:05 searched on 'weapon', receive hits for the script document, manual document, and Testing 1. Testing 0 and Testing 2 are still not found
9/12@17:40 searched on 'weapon', receive hits for the script document, manual document, and Testing 1. Testing 0 and Testing 2 are still not found

在通过脚本创建文档时,我应该做些什么来让它们为搜索编制索引。我查看了文档并且没有看到任何内容。

1 个答案:

答案 0 :(得分:0)

这似乎是一个错误,看起来您已经为此问题提交了an issue

相关问题