Alright so I've got a ListView with many items available to it any time (in virtualized mode). Right above the ListView is a text box that allows the user type in any search term and the ListView will be filtered live. The ListView is currently bound to a DataSet like this:
SoundListView.DataContext = DS.Tables[0].DefaultView;
The DataSet is being pulled from an internal SQLite database.
And here is the current filter code that takes the search box text to filter the ListView:
DS.Tables[0].DefaultView.RowFilter = String.Format("path LIKE '%{0}%'", EscapeLikeValue(SearchTextBox.Text));
You can see here I am using a crappy LIKE SQL modifier to filter my items based on the key term. This is bad because LIKE isn't a replacement for full-text search IMO. To solve this problem, I implemented Lucence.NET.
Using Lucene, I am taking the search term from the text box and it is performing a more Google-esque search, where I can use boolean operators and do fuzzy matching and cool things like that. This search is currently working! The Lucene search is returning a list of IDs that correspond to the IDs in the DataSet feeding the ListView.
So the last piece of my puzzle is getting these Lucene search hits to filter the ListView. Should I use RowFilter and concanenate all of the IDs that match in some horrible SQL line like:
... RowFilter = "id = 1 OR id = 3 OR id = 7"
Or is there a better way to do this?