首页 > 解决方案 > 搜索索引 npm

问题描述

我目前正在开发一个 Javascript 项目,我想使用 search-index 来搜索一组不同的 js 对象。它可以工作,但是,它会在主目录的级别 DB 数据库中跟踪所有先前的搜索结果。

我不希望这样,因为用户只会对最近的搜索结果感兴趣。感谢任何可以帮助我在每次搜索后清除数据库或提供类似于搜索索引的方法的人。

我要搜索的对象的基本结构如下。我的主要问题是每个对象都有自己独特的文本路径,我想在每个路径中搜索文本,这就是 search-index 所做的。

    [{ dmodule: { identAndStatusSection: [Object], content: [Object] } },

  { dmodule: { identAndStatusSection: [Object], content: [Object] } },

  { dmodule: { identAndStatusSection: [Object], content: [Object] } },

  { dmodule: { identAndStatusSection: [Object], content: [Object] } },

  { dmodule: { identAndStatusSection: [Object], content: [Object] } },

  { dmodule: { identAndStatusSection: [Object], content: [Object] } },

  { dmodule: { identAndStatusSection: [Object], content: [Object] } },

  { dml: { identAndStatusSection: [Object], dmlContent: [Object] } },

  { pm: { identAndStatusSection: [Object], content: [Object] } },

  { pm: { identAndStatusSection: [Object], content: [Object] } },

  { pm: { identAndStatusSection: [Object], content: [Object] } },

  { pm: { identAndStatusSection: [Object], content: [Object] } }]

标签: javascriptnode.jsobjectleveldb

解决方案


推荐阅读