Вопрос

I'm struggling with this problem for quit a while.

This is what I want to do:

I want to build a query for the Windows Indexing Service that should look like this

SELECT ... FROM  (TABLE Catalog1..Scope('Deep traversal of "Path1"','Deep traversal of "Path2"') UNION ALL TABLE Catalog2..Scope('Deep traversal of "Path3"')) WHERE ...

I get the information from a <asp:Listbox SelectionMode=multiple> (which has a file as data-source)

And it comes in the following way:

'DisplayNameInListbox1'=Catalog1@Path1;Path2&Catalog2
'DisplayNameInListbox2'=Catalog1@Path1
'DisplayNameInListbox3'=Catalog1@Path1;Path2&Catalog2@Path3
...

In one of the Listbox values can be multiple catalogs and multiple values can be selected. Each catalog can stand alone or be restricted to specified paths(@path;path2)

My attempt: I tried to store all the information in a Dictionary<string Catalog, List<string Paths>> which works fine if I don't select two values which contain the same catalog name. I also can't just skip a catalog if I already have a key with that name because the path restrictions could be different.

Can anyone help me to find a good way solving this problem? (it would also be possible to change the way the data is stored - I just need to be able to provide it to the Listbox from a file)

Cheers

Это было полезно?

Решение

Here comes the solution to my problem:

I guess most of the time the simplest solution is the best!

I divided the problem in two parts. Now I first merge the catalogs and paths so every catalog exits only once in the dictionary.

And in the second step I can build the query sequentially :)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top