I get that a searcher needs an index to search, but why not let us create an instance of the searcher which doesn't blow up untill consumed? It takes an Directory as dependency, not a writer... The LuceneDirectory could be responsible for initializing the dir so that the searcher doesn't have a direct dependency on the writer. The dir should then notify dependent searcher(s), "hey, the indexed changed"... That way the searcher can be created and Or maybe return null as result of searches when no index exists.
//Daniel 2010/7/5 Digy <[email protected]> > No. To make a search, you have to have an index > and Indexes are created with IndexWriter. > (creating an empty index with IndexReader(or IndexSearcher) would be weird) > DIGY > > -----Original Message----- > From: Daniel Wertheim [mailto:[email protected]] > Sent: Monday, July 05, 2010 10:03 PM > To: [email protected] > Subject: Re: Problems with IndexSearcher > > Hi, > Why? Doesn't that create an unclear coupling from the Searcher to the > Writer? > > Does this mean that they should be seen as one "unit"? > > //Daniel > > 2010/7/5 Digy <[email protected]> > > > No. You have to initialize it with an IndexWriter. > > DIGY > > > > -----Original Message----- > > From: Daniel Wertheim [mailto:[email protected]] > > Sent: Monday, July 05, 2010 7:59 PM > > To: [email protected] > > Subject: Fwd: Problems with IndexSearcher > > > > ---------- Forwarded message ---------- > > From: Daniel Wertheim <[email protected]> > > Date: 2010/7/5 > > Subject: Problems with IndexSearcher > > To: [email protected] > > > > > > Hi, > > > > Isn't it possible to create an instance of an IndexSearcher for a > directory > > that is empty? Note, I don't consume it, just create it, still there's an > > exception thrown: > > > > "no segments* file found in Lucene.Net.Store.SimpleFSDirectory" > > > > If I create an writer first, everything works fine. > > > > //Daniel > > > > > >
