lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alice" <aliceli...@gmail.com>
Subject RE: Customized Analyzer
Date Tue, 05 Dec 2006 21:08:18 GMT
Ok,

This is the method that adds the aliases, it is located in my SynonymFilter:

private void addAliasesToStack(Token token)
{
        String[] synonyms = engine.getSynonyms("contents",
token.termText());
        
        if (synonyms == null)
        {
            return;
        }
        
        for (int i = 0; i < synonyms.length; i++)
        {
            Token synToken = new Token(synonyms[i], token.startOffset(),
token.endOffset(), token.type());
            synToken.setPositionIncrement(0);
            
            modelSynonymStack.push(synToken);
        }
    }


And at the Search class, the query is done like that:
Query query = new QueryParser("contents", new
SynonymAnalyzer()).parse(keyword);

And the return is: contents:"(wind window)"
And no hit...


-----Original Message-----
From: Daniel Naber [mailto:lucenelist2005@danielnaber.de] 
Sent: terça-feira, 5 de dezembro de 2006 18:58
To: java-user@lucene.apache.org
Subject: Re: Customized Analyzer

On Tuesday 05 December 2006 21:37, Alice wrote:

> It does not work.
>
> Even with the synonyms indexed it is not found.

So if your text contains "wind" it is not found by the query that prints as 
content:"(wind window)"? Then I suggest you post a small test case that 
shows this problem. As Chris said, calling setPositionIncrement(0) is 
important.

Regards
 Daniel

-- 
http://www.danielnaber.de

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message