Czytałem parę razy i szczerze mówiąc nie wiem, czy ja czegoś nie łapę, czy Ty totalnie nie napisałeś, o co chodzi.
Kategoria to Newbie - czyli nic nie mówi o języku/technologii.
Tagi - podobnie, nie dają żadnej wskazówki.
W treści również nie znalazłem niczego pomocnego, piszesz o jakimś tekście do przefiltrowania, ale nie podajesz czy to PDF, DOC, HTML czy może tekst do przetworzenia w jakiejś pisanej przez Ciebie aplikacji. Daj więcej szczegółów, bo z tego co napisałeś (mimo, że edytowałeś posta 15 razy) za wiele nie wynika (a przynajmniej dla mnie - może są tutaj ludzie, którzy ogarną tak podany temat).
To, czy jest to PDF/DOC/HTML jest najmniej ważne - dane są w zmiennej
np. Lista stron.
Weźmy jakiś pseudokod
foreach (var strona in strony)
{
if (strona.Contains("word1"))
{
do something
}
}
Lecz tych ifów może być 0, 10, 100 - jak tam user sobie chce, a dodatkowo mogą być czymś innym niż tylko .Contains
np. strona.Length > 100
Ten sam problem, lecz w innych słowach.
I'm trying to figure out a way to allow users of my application to define their own queries or filters that can be applied to a collection. I want to eventually provide an intuitive user interface to create these filters (see image below), but initial it would be OK if a user had to type of a text query string. I'll also need to be able to serialized these user defined queries to a string so I can save them with the rest of the project information.
Example UI alt text http://dl.dropbox.com/u/113068/filterUI.jpg
I'm looking for the type of functionality you would get out of something like a SQL query such as numeric conditions (less than, greater than), string condition (contains, starts with, ends with), or boolean condition (true or false). I'd also like to be able to group condition using boolean logic like OR, AND, and NOT.
I started drawing out how I would do this from scratch using classes such as NodeFilter, AbsNodeCondition, NodeStringCondition, NodeConditionOrJoin etc.. etc.. But I feel like I'm reinventing the wheel, especially when there's something like Linq available, which I haven't had a chance to spend much time with.
Could I somehow allow a user to enter a Linq to objects query in a text box, and then programaticly turn the string into a real Linq query that can be applied to my collection? Or is there some other way I could allow the user to create and save a query? I'll also need a way to serialize the filter/query to a string so I can save it with the rest of the program information.