Skip to content

SimpleFSDirectoryFactory build a bad root of the index #24

@MateosTDD

Description

@MateosTDD

SimpleFSDirectoryFactory mount a bad route of the index because add the name of the index to _options.IndexesDirectory, and after search the index inside of that folder

Example:
I create a index called 'product's and it produces that I have a index called 'products.index.json' in the folder 'app/indexes'

The problem is that the class SimpleFSDirectoryFactory search that index in the folder 'app/indexes/products' and not 'app/indexes'

The error is this piece of code

  public Directory GetDirectory(string indexName)
  {
      indexName = indexName.ToLowerInvariant();

      if (_directories.TryGetValue(indexName, out var directory))
      {
          return directory;
      }

      **var path = Path.Join(Path.GetFullPath(_options.IndexesDirectory), indexName.ToLowerInvariant());**

      directory = new SimpleFSDirectory(path);

      _directories.TryAdd(indexName, directory);

      return directory;
  }

I think that path must be _options.IndexesDirectory without the join method

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions