Sorry slight correction for the code below: I was actually using the WhitespaceAnalyzer, not the StandardAnalyzer in constructing the NGramAnalyzerWrapper.

On Tue, 26 Feb 2008, Stanley Xinlei Wang wrote:

Hi,

In Lucene, I'm trying to perform word-level bi-gram query parsing using NGramAnalyzerWrapper. I'm couldn't get any word pairs in the parsed query and I was wondering what I should do to make this work. I'm using Lucene 2.2.0

I'm using the files from: https://issues.apache.org/jira/browse/lucene-400

My code is:

NGramAnalyzerWrapper analyzer = new NGramAnalyzerWrapper(new
        StandardAnalyzer(), 2);
QueryParser p = new QueryParser("info", analyzer);
Query query = lyricsParser.parse("this is my query");
System.out.println(query.toString());

When I run this, I get the following output, which has no bi-grams:

lyrics:this lyrics:is lyrics:a lyrics:query


Thank you for your help!

Stanley


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to