You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Michael Celona <mc...@criticalmention.com> on 2005/01/26 23:39:29 UTC

text highlighting

Does any have a working example of the highlighter class found in the
sandbox?

-----Original Message-----
From: Jason Polites [mailto:jasonpolites@tpg.com.au] 
Sent: Wednesday, January 26, 2005 5:34 PM
To: Lucene Users List
Subject: Re: Search Engine review article/book

Also:

http://labs.google.com/papers.html
http://research.microsoft.com/wsm/

----- Original Message ----- 
From: "Stefan Groschupf" <sg...@media-style.com>
To: "Lucene Users List" <lu...@jakarta.apache.org>
Sent: Thursday, January 27, 2005 9:27 AM
Subject: Re: Search Engine review article/book


>+  the lucene in action book. :-)
> +  scholar.google.com
> + acm.org ir group
> + ieee.org has ir group as well
> may you will find http://searchenginewatch.com/ useful as well.
> 
> HTH
> Stefan
> 
> 
> Am 26.01.2005 um 23:18 schrieb Xiaohong Yang ((Sharon)):
> 
>> Hi all,
>>
>> I am looking for good review articles or books regarding latest search 
>> engine development trend and practices.  Any suggestions would be very 
>> helpful.  Any comments not covered by articles are also welcome.
>>
>> Thanks a lot,
>>
>> Sharon
>>
> ---------------------------------------------------------------
> company: http://www.media-style.com
> forum: http://www.text-mining.org
> blog: http://www.find23.net
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
>

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



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


Re: text highlighting

Posted by Robert Koberg <ro...@koberg.com>.
A relevant link :)

http://www.tbray.org/ongoing/When/200x/2005/01/26/PatentFunnies


Erik Hatcher wrote:
> Also, there are some examples in the Lucene in Action source code (grab  
> it from http://www.lucenebook.com) (see HighlightIt.java).
> 
>     Erik
> 
> On Jan 26, 2005, at 5:52 PM, markharw00d wrote:
> 
>> Michael Celona wrote:
>>
>>> Does any have a working example of the highlighter class found in the
>>> sandbox?
>>>
>>>
>> There are several in the accompanying Junit test:
>> http://cvs.apache.org/viewcvs.cgi/jakarta-lucene-sandbox/ 
>> contributions/highlighter/src/test/org/apache/lucene/search/highlight/
>>
>>
>> Cheers
>> Mark
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


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


Re: text highlighting

Posted by Youngho Cho <yo...@nannet.co.kr>.
More test result

if the text contains  ... Family ...
Than

family query string woks OK.
But if the query stirng is Family than the highlighter return none.


Thanks.

Youngho

----- Original Message ----- 
From: "Youngho Cho" <yo...@nannet.co.kr>
To: "Lucene Users List" <lu...@jakarta.apache.org>
Cc: "Che Dong" <ch...@hotmail.com>
Sent: Thursday, January 27, 2005 6:10 PM
Subject: Re: text highlighting


> Hello,
> 
> When I used the code with CJKAnalyzer and search English Text 
> (Because the text is mixed with Korean and English )
> sometimes the return Stirng is none.
> Others works well.
> 
> Is the code analyzer dependancy ?
> 
> Thanks.
> 
> Youngho
> 
> -------  Test Code ( Just copy of the Book code ) ---------
> 
>     private static final String HIGH_LIGHT_OPEN = "<span class=\"highlight\">";
>     private static final String HIGH_LIGHT_CLOSE = "</span>";
> 
>     public static String highLight(String value, String queryString)
>         throws IOException
>     {
>         if (StringUtils.isEmpty(value) || StringUtils.isEmpty(queryString))
>         {
>             return value;
>         }
> 
>         TermQuery query = new TermQuery(new Term("h", queryString));
>         QueryScorer scorer = new QueryScorer(query);
>         SimpleHTMLFormatter formatter = new SimpleHTMLFormatter(HIGH_LIGHT_OPEN,
>                 HIGH_LIGHT_CLOSE);
>         Highlighter highlighter = new Highlighter(formatter, scorer);
> 
>         Fragmenter fragmenter = new SimpleFragmenter(50);
> 
>         highlighter.setTextFragmenter(fragmenter);
> 
>         TokenStream tokenStream = new CJKAnalyzer().tokenStream("h",
>                 new StringReader(value));
> 
>         return highlighter.getBestFragments(tokenStream, value, 5, "...");
>     }
> 
> ----- Original Message ----- 
> From: "Erik Hatcher" <er...@ehatchersolutions.com>
> To: "Lucene Users List" <lu...@jakarta.apache.org>
> Sent: Thursday, January 27, 2005 8:37 AM
> Subject: Re: text highlighting
> 
> 
> > Also, there are some examples in the Lucene in Action source code (grab  
> > it from http://www.lucenebook.com) (see HighlightIt.java).
> > 
> > Erik
> > 
> > On Jan 26, 2005, at 5:52 PM, markharw00d wrote:
> > 
> > > Michael Celona wrote:
> > >
> > >> Does any have a working example of the highlighter class found in the
> > >> sandbox?
> > >>
> > >>
> > > There are several in the accompanying Junit test:
> > > http://cvs.apache.org/viewcvs.cgi/jakarta-lucene-sandbox/ 
> > > contributions/highlighter/src/test/org/apache/lucene/search/highlight/
> > >
> > >
> > > Cheers
> > > Mark
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-user-help@jakarta.apache.org

Re: text highlighting

Posted by Youngho Cho <yo...@nannet.co.kr>.
Hello,

When I used the code with CJKAnalyzer and search English Text 
(Because the text is mixed with Korean and English )
sometimes the return Stirng is none.
Others works well.

Is the code analyzer dependancy ?

Thanks.

Youngho

-------  Test Code ( Just copy of the Book code ) ---------

    private static final String HIGH_LIGHT_OPEN = "<span class=\"highlight\">";
    private static final String HIGH_LIGHT_CLOSE = "</span>";

    public static String highLight(String value, String queryString)
        throws IOException
    {
        if (StringUtils.isEmpty(value) || StringUtils.isEmpty(queryString))
        {
            return value;
        }

        TermQuery query = new TermQuery(new Term("h", queryString));
        QueryScorer scorer = new QueryScorer(query);
        SimpleHTMLFormatter formatter = new SimpleHTMLFormatter(HIGH_LIGHT_OPEN,
                HIGH_LIGHT_CLOSE);
        Highlighter highlighter = new Highlighter(formatter, scorer);

        Fragmenter fragmenter = new SimpleFragmenter(50);

        highlighter.setTextFragmenter(fragmenter);

        TokenStream tokenStream = new CJKAnalyzer().tokenStream("h",
                new StringReader(value));

        return highlighter.getBestFragments(tokenStream, value, 5, "...");
    }

----- Original Message ----- 
From: "Erik Hatcher" <er...@ehatchersolutions.com>
To: "Lucene Users List" <lu...@jakarta.apache.org>
Sent: Thursday, January 27, 2005 8:37 AM
Subject: Re: text highlighting


> Also, there are some examples in the Lucene in Action source code (grab  
> it from http://www.lucenebook.com) (see HighlightIt.java).
> 
> Erik
> 
> On Jan 26, 2005, at 5:52 PM, markharw00d wrote:
> 
> > Michael Celona wrote:
> >
> >> Does any have a working example of the highlighter class found in the
> >> sandbox?
> >>
> >>
> > There are several in the accompanying Junit test:
> > http://cvs.apache.org/viewcvs.cgi/jakarta-lucene-sandbox/ 
> > contributions/highlighter/src/test/org/apache/lucene/search/highlight/
> >
> >
> > Cheers
> > Mark
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org

Re: text highlighting

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Also, there are some examples in the Lucene in Action source code (grab  
it from http://www.lucenebook.com) (see HighlightIt.java).

	Erik

On Jan 26, 2005, at 5:52 PM, markharw00d wrote:

> Michael Celona wrote:
>
>> Does any have a working example of the highlighter class found in the
>> sandbox?
>>
>>
> There are several in the accompanying Junit test:
> http://cvs.apache.org/viewcvs.cgi/jakarta-lucene-sandbox/ 
> contributions/highlighter/src/test/org/apache/lucene/search/highlight/
>
>
> Cheers
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org


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


Re: text highlighting

Posted by markharw00d <ma...@yahoo.co.uk>.
Michael Celona wrote:

>Does any have a working example of the highlighter class found in the
>sandbox?
>
>  
>
There are several in the accompanying Junit test:
http://cvs.apache.org/viewcvs.cgi/jakarta-lucene-sandbox/contributions/highlighter/src/test/org/apache/lucene/search/highlight/


Cheers
Mark


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