Hi,

On Thu, 2007-03-15 at 22:13 -0700, Chris Martin wrote:
> I'm 99% positive that the query objects that I'm generating are just
> what I want. I just don't see how I can use my Analyzer with them.
> Which, I think is the real problem here.

Yeah, you're probably right.  Given the same input, what does
Query.ToString() for your old code and your new code give you?  My guess
is that they're probably pretty different if one is being analyzed and
one isn't.

> TermQuery q = new TermQuery( new Term( field.Name, searchTerm.ToString() ) );

Instead of doing this, run your searchTerm through an analyzer first.
Something like this should work (caution: untested):

        PhraseQuery q = new PhraseQuery ();
        TokenStream source = analyzer.TokenStream (field.Name, new StringReader 
(searchTerm.ToString ()));
        
        while (true) {
                Token token = source.Next ();
                
                if (token == null)
                        break;
                
                Term term = new Term (field.Name, token.TermText ());
                q.Add (term);
        }
        
        source.Close ();
        
Joe

Reply via email to