--- Lee Mallabone <[EMAIL PROTECTED]> wrote: > I've just done a whole bunch of code > browsing/digging, and it's as you > suspected - the WildcardQuery.prepare() method must > be executed so that the > enum is set correctly. It turns out that this gets > done when > Searcher.search() is called. > > So I think the summary of this is that > LuceneTools.getTerms() will crash if > a query containing wildcards has been parsed but not > executed?
Yes, that's because PrefixQuery, WildcardQuery and FuzzyQuery all needs to look through the index to construct the enum that lists the terms that matches. MultiTermQuery comes in after that to convert that enum of terms into a BooleanQuery, which happens in getQuery(). Thus I don't think null pointer will be thrown if getQuery is only called after search(). In the meantime, I'll put in additional safeguards to ensure that null pointer isn't thrown if search() hasn't been called. > This certainly isn't the end of the world, but maybe > it should be noted in > the docs? It's already documented. Look at the javadoc for the MultiTermQuery class. __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com
