November Happy Hour will be moved to Thursday December 5th.

UnifiedDirectory.Search not a directory issue

Vote:
 

int userId = 100;

string virtualDir = "/Global/UserPetImages";

UnifiedDirectory directory = HostingEnvironment.VirtualPathProvider.GetDirectory(virtualDir) as UnifiedDirectory;

string fileNamePattern = string.Format("User{0}_PetImage", userId);

UnifiedSearchHitCollection searchResult = directory.Search(query);

 

On the sample code above, I get an error D:\MySite\VPP\Global\index not a directory

I can assure you that the UnifiedDirectory is getting the right one and I could even call directory.GetFiles() and retrieve correct results.

 

Would you know where \Global\index came from?

#52091
Jul 06, 2011 1:06
Vote:
 

I get the error on this line "UnifiedSearchHitCollection searchResult = directory.Search(query);"

#52092
Jul 06, 2011 1:08
Vote:
 

Here's the correct sample code:

int userId = 100;

string virtualDir = "/Global/UserPetImages";

UnifiedDirectory directory = HostingEnvironment.VirtualPathProvider.GetDirectory(virtualDir) as UnifiedDirectory;

string fileNamePattern = string.Format("User{0}_PetImage", userId);

UnifiedSearchQuery query = new UnifiedSearchQuery();

query.FileNamePattern = fileNamePattern;

UnifiedSearchHitCollection searchResult = directory.Search(query);

 


#52093
Jul 06, 2011 1:10
Vote:
 

Manually searching in FileManager yields same result

Number of hits: 0
VirtualPathProvider 'SiteGlobalFiles', Search Error: D:\MySite\VPP\Global\index not a directory

 

#52094
Jul 06, 2011 3:14
Vote:
 

It's all good now. I manually needed to add an entry in the EPiServer.IndexingService.exe.config file located at C:\Program Files (x86)\EPiServer\Shared\Services\Indexing Service\

#52095
Jul 06, 2011 3:32
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.