Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subfolders in directory structure brake the search index #42

Open
sstraus opened this issue Aug 12, 2021 · 2 comments
Open

Subfolders in directory structure brake the search index #42

sstraus opened this issue Aug 12, 2021 · 2 comments

Comments

@sstraus
Copy link

sstraus commented Aug 12, 2021

I found a strange behavior using subfolders.
My structure has a single container with many subfolders, one for each user.
The first time the subfolders is created and filled everything works fine.
But once reloaded, initializing the azure directory again, the index is empty.
This doesn’t happen when I use root folder instead.
I checked the paths in the lib but everything looks correct.

Any suggestion?

thank you.

@richorama
Copy link
Member

interesting - I haven't seen this before, but if I get some time I'll try to track it down.

@sstraus
Copy link
Author

sstraus commented Aug 12, 2021

Thank you, I'm going crazy. A sample to replicate the problem, with sub = null works, any other value will reset the index.

` static void ErrorTest(string sub = null)
{

     var azureDirectory = new AzureDirectory(
         "DefaultEndpointsProtocol=xxx",
         "cachedir", "test", false, sub);

     var indexWriterConfig = new IndexWriterConfig(
         LuceneVersion.LUCENE_48,
         new StandardAnalyzer(LuceneVersion.LUCENE_48));

     var indexWriter = new IndexWriter(azureDirectory, indexWriterConfig);
     Document doc = new Document();
     doc.Add(new TextField("id", DateTime.Now.ToString(CultureInfo.InvariantCulture), Field.Store.YES));
     indexWriter.AddDocument(doc);
     indexWriter.Commit();
     var nd1 = indexWriter.NumDocs;
     indexWriter.Dispose();
     azureDirectory.Dispose();

     var indexWriterConfig2 = new IndexWriterConfig(
         LuceneVersion.LUCENE_48,
         new StandardAnalyzer(LuceneVersion.LUCENE_48));
         
     var azureDirectory2 = new AzureDirectory(
         "DefaultEndpointsProtocol=xxx",
         "cachedir", "test", false, sub); 

     var indexWriter2 = new IndexWriter(azureDirectory2, indexWriterConfig2);
     var nd2 = indexWriter2.NumDocs;
     indexWriter2.Dispose();
     azureDirectory2.Dispose();
     Console.WriteLine(nd1 == nd2);
 }`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants