You should be using the same analyzer when you query as when you built the index. I suspect that in this case you need to make an analyzer that recognises both English and Greek.

I hope this helps,

        Eleanor Joslin

[EMAIL PROTECTED] wrote:
Hello

i am having the following code to highlight a text

public String highlight(String text, String query ) throws IOException {
TermQuery query = new TermQuery(new Term("f", query));
    QueryScorer scorer = new QueryScorer(query);
    SimpleHTMLFormatter formatter =
        new SimpleHTMLFormatter("<span class=\"highlight\">",
            "</span>");
    Highlighter highlighter = new Highlighter(formatter, scorer);
    Fragmenter fragmenter = new SimpleFragmenter(50);
    highlighter.setTextFragmenter(fragmenter);

    TokenStream tokenStream = new GreekAnalyzer()
        .tokenStream("f", new StringReader(text));

String result = highlighter.getBestFragments(tokenStream, text, 5, "...");

  return result;
}

if i use a text with english characters works fine if i try a text with Greek Character i am getting en empty string as result.
Why?

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




--
Eleanor Joslin, Software Development   DecisionSoft Ltd.
Telephone: +44-1865-203192             http://www.decisionsoft.com

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

Reply via email to