const searchLib = require('@groupdocs/groupdocs.search')
// ตั้งค่าไดเรกทอรีสำหรับการจัดทำดัชนีการค้นหา
const index = new searchLib.Index("c:/MyIndex");
// ระบุที่อยู่ไฟล์สำหรับการจัดเก็บเอกสาร
index.add("c:/MyDocuments");
// ป้อนรหัสผ่านสำหรับไฟล์ที่ปกป้อง
index.getDictionaries().getDocumentPasswords().add("protected.xlsx", '123456');
// เปิดใช้งานการค้นหาคำที่ฟังดูคล้ายกัน
const options = new searchLib.SearchOptions();
options.getFuzzySearch().setEnabled(true);
options.getFuzzySearch().setFuzzyAlgorithm(new searchLib.SimilarityLevel(0.8));
// ดึงผลลัพธ์การค้นหา
const result = index.search("Loarem", options);
// ประมวลผลและตรวจสอบผลลัพธ์
console.log('Documents: ' + result.getDocumentCount());
console.log('Occurrences: ' + result.getOccurrenceCount());