lucaong / minisearch

Tiny and powerful JavaScript full-text search engine for browser and Node
https://lucaong.github.io/minisearch/
MIT License
4.83k stars 137 forks source link

removeAll missing this._fieldIds = {} #89

Closed Lee182 closed 3 years ago

Lee182 commented 3 years ago

I'm just looking at the source code for this libary because I'm looking to adapt it for my own project.

I noticed in constructor _fieldsIds is reset, yet in removeAll it is not. Is this intentional or a mini memory bug?

// MiniSearch.ts constructor
    this._index = new SearchableMap()

    this._documentCount = 0

    this._documentIds = {}

    this._fieldIds = {}

    this._fieldLength = {}

    this._averageFieldLength = {}

    this._nextId = 0

    this._storedFields = {}
// MiniSearch.ts removeAll
      this._index = new SearchableMap()
      this._documentCount = 0
      this._documentIds = {}
      this._fieldLength = {}
      this._averageFieldLength = {}
      this._storedFields = {}
      this._nextId = 0
Lee182 commented 3 years ago

Ah silly me it intention sorry to bother.

lucaong commented 3 years ago

No problem @Lee182 , and thanks for taking the time to open an issue, even if it ended up being correct :)