Skip to content

Commit

Permalink
Fix an error in creat index from scratch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Songkai.Tang committed Sep 12, 2018
1 parent 2be82a2 commit 6bb0fce
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions OneNotePageSearcher/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OneNotePageSearcher/publish/*
9 changes: 8 additions & 1 deletion OneNotePageSearcher/NetLuceneProvider.cs
Original file line number Diff line number Diff line change
@@ -52,7 +52,14 @@ public void SetUpReader()
public void SetUpWriter(bool overwrite = true)
{
SetWorkingDirectory();
writer = new IndexWriter(indexDirectory, _analyzer, overwrite, IndexWriter.MaxFieldLength.UNLIMITED);
try
{
writer = new IndexWriter(indexDirectory, _analyzer, overwrite, IndexWriter.MaxFieldLength.UNLIMITED);
}
catch (Exception e)
{
writer = new IndexWriter(indexDirectory, _analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
}
}

public void CloseWriter()
3 changes: 2 additions & 1 deletion OneNotePageSearcher/OneNotePageSearcher.csproj
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>4</ApplicationRevision>
<ApplicationVersion>0.0.0.%2a</ApplicationVersion>
<ApplicationVersion>0.0.0.4</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
@@ -121,6 +121,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Include=".gitignore" />
<None Include="App.config" />
<None Include="OneNotePageSearcher_TemporaryKey.pfx" />
</ItemGroup>

0 comments on commit 6bb0fce

Please sign in to comment.