static ICollection GetAllItemsInDirectory(DirectoryInfo dir)
{
// form the query
string parent_uri_str = PathToUri (dir.FullName).ToString ();
// Instead of taking the painfull way of using BeagrepAnalyzer, lets just add the prefix manually
// LuceneCommon thinks exposing secret property type encoding is bad, I think so too... except for now
string key = "prop:k:" + Property.ParentDirUriPropKey;
//Logger.Log.Debug ("Querying for {0}={1}", parent_uri_str, key);
LNS.Query query = new LNS.TermQuery (new Term (key, parent_uri_str));
// do the search
LNS.IndexSearcher searcher;
searcher = LuceneCommon.GetSearcher (driver.PrimaryStore);
BetterBitArray matches;
matches = new BetterBitArray (searcher.MaxDoc ());
BitArrayHitCollector collector;
collector = new BitArrayHitCollector (matches);
searcher.Search (query, null, collector);
// Finally we pull all of the matching documents,
// convert them to Dirent, and store them in a list.
ArrayList match_list = new ArrayList ();
int i = 0;
while (i < matches.Count) {
i = matches.GetNextTrueIndex (i);
if (i >= matches.Count)
break;
Document doc;
doc = searcher.Doc (i);
Dirent info;
info = DocumentToDirent (doc);
match_list.Add (info);
++i;
}
LuceneCommon.ReleaseSearcher (searcher);
//Logger.Log.Debug ("Found {0} items in {1}", match_list.Count, dir.FullName);
return match_list;
}