Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

DirectoryNotFoundException - SearchUnit - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
sebking
#1 Posted : Tuesday, February 4, 2014 10:53:37 AM
Rank: Member

Groups: Registered

Joined: 11/14/2013
Posts: 10
Hello,
we recently had an exception while executing the Crawler (Keyoti.SearchEngine.Core.dll is 2012.5.13.402):

Code:

System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\VisualStudio\[...]\Tools\KeyotiCrawler\bin
elease\KeyotiIndexes\institutional\KeyotiIndexes\institutional\_location.xml'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.Delete(String path)
   at Keyoti.SearchEngine.DataAccess.XmlDataAccess.d(String A_0)
   at Keyoti.SearchEngine.DataAccess.XmlDataAccess.Close()
   at Keyoti.SearchEngine.Index.IndexableSources.IndexableSource.Close()
   at Keyoti.SearchEngine.Index.DocumentIndex.Import(IndexableSourceRecord indexableSourceRecord, IIndexableSource dataSource)
   at Keyoti.SearchEngine.Index.DocumentIndex.Import(IndexableSourceRecord indexableSourceRecord)


The configured Keyoti.SearchEngine.Configuration.IndexDirectory is "KeyotiIndexes\institutional".
The path given in the exception contains that path fragment twice which doesn't seem correct.

I took a look in the decompiled code using doPeek and if the decompiled code is correct the IndexDirectory path is used twice in calls of Path.Combine(string, string) resulting in the path stated in the above exception.
Jim
#2 Posted : Tuesday, February 4, 2014 4:03:35 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
Hi, could you show me how and where you're setting the index dir please?

Thanks
Jim

-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


sebking
#3 Posted : Wednesday, February 5, 2014 8:10:52 AM
Rank: Member

Groups: Registered

Joined: 11/14/2013
Posts: 10
Hi,

we set the directory basically like that:

Code:

var config = new Keyoti.SearchEngine.Configuration
{
    IndexDirectory = Path.Combine("KeyotiIndexes", "institutional"),
    UserAgent = "keyoti-" + "institutional",
    Logging = EnableLogging
};
var index = new DocumentIndex(config);
index.ImportWebsite(_crawlUrl);
Jim
#4 Posted : Thursday, February 6, 2014 1:38:35 AM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
quote:

I took a look in the decompiled code using doPeek and if the decompiled code is correct the IndexDirectory path is used twice in calls of Path.Combine(string, string) resulting in the path stated in the above exception.



I'd be interested to see that. I only see one Path.Combine in the whole of our DocumentIndex class.

To me it seems like the current directory that Directory.GetCurrentDirectory(); would return is actually


System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\VisualStudio\[...]\Tools\KeyotiCrawler\bin
elease\KeyotiIndexes\institutional\

One solution is to not rely on the current directory to be set to where the app EXE is, but set it explicitly

http://stackoverflow.com...net-console-application

Jim


-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


sebking
#5 Posted : Monday, February 10, 2014 9:08:50 AM
Rank: Member

Groups: Registered

Joined: 11/14/2013
Posts: 10
The noted Path.Combine(..) calls are in the XmlDataAccess class in the Keyoti.SearchEngine.DataAccess namespace. The method's name is obfuscated to "d(String A_0)" which gets called in the XmDataAccess's Close() method.

I highlighted the calls to Path.Combine in question

Code:

    private void d(string A_0)
    {
      StringBuilder stringBuilder = new StringBuilder("_");
      stringBuilder.Append(A_0);
      string path2 = ((object) stringBuilder).ToString();
      string str1 = Path.Combine(this.Configuration.IndexDirectory, A_0);
      <font color="red">string str2 = Path.Combine(this.Configuration.IndexDirectory, path2);</font id="red">
      if (File.Exists(str1) && File.Exists(str2))
        File.Delete(str1);
      if (!File.Exists(str2))
        return;
      File.Copy(str2, str1);
     File.Delete(<font color="red">Path.Combine(this.Configuration.IndexDirectory, str2)</font id="red">);
    }
Jim
#6 Posted : Monday, February 10, 2014 5:24:01 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
Thanks, you're right - sorry, I think because usually when used with the controls or our UI it will have absolute paths, so the problem doesn't arise.

Anyhow, if you don't want to use an absolute path as I showed above, then here's a new MSI (make sure you uninstall first)

(link archived - Search_ASP.NET-Setup-2012-DoubleCombinePath.msi)

Best
Jim


<i>-your feedback is helpful to other users, thank you!</i>

-your feedback is helpful to other users, thank you!


sebking
#7 Posted : Tuesday, February 11, 2014 3:13:32 PM
Rank: Member

Groups: Registered

Joined: 11/14/2013
Posts: 10
Thank you very much. Looks like it works now. [:)]
Thank you for your support
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.




About | Contact | Site Map | Privacy Policy

Copyright © 2002- Keyoti Inc.