Try our conversational search powered by Generative AI!

How to filter from virtualpath

Vote:
 

I need to just get those file that resides in a certain VPP path, for example "/Documents/Policys/"

Can I do this using the .Filter() ?

.Match and MatchContains does not seems to work here, I am lost

regards

Fredrik

 

#61827
Oct 03, 2012 10:26
Vote:
 

You can do a prefix filter on the path, ie Filter(x => x.VirtualPath.Prefix("/Documents/Policys")). 

#61832
Oct 03, 2012 13:52
Vote:
 

Works like a charm, thanks!

#61833
Oct 03, 2012 14:02
Vote:
 

I'm guessing that it might not be relevant in this case, but just adding for anyones future reference:

Another option would be to create an extension method for UnifiedFile that returns only the folder(s) part of the path, alternatively some other value depending on the path. The return value of this could then be included when indexing (more on that here). After doing that one could instead filter on that, ie .Filter(x => x.FolderPath().Match(...)).

That in it self doesn't provide much benefit, but the indexed value could then also be used to facet on, for instance creating a UI that contained:

Filter by path

/Documents/A (123)
/Documents/B (42)
/Images (3142)

#61834
Oct 03, 2012 14:10
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.