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 Gwyn Carwardine <gw...@carwardine.net> on 2006/01/24 22:28:23 UTC

Highlighter

I'm using the .net port of highlighter (1.5) and I notice it doesn't
highlight range or prefix queries.. Is this consistent with the java
version? Only I note my standard reference of www.lucenebook.com seems to
support highlighting.. is this using that same highlighter version (couldn't
find any verison info on the lucene apache site)

TIA

-Gwyn


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


Re: Highlighter

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 25, 2006, at 6:39 AM, Gwyn Carwardine wrote:

>>> Yes I think you're right. On reading the "lucene in action"  
>>> chapted on
>>> highlighting I found it squirreled in the middle of the text. I get
>>> the
>>> feeling that whilst I have so far found query parser to be the  
>>> primary
>>> method of building queries that this is not ht eprimary method used
>>> by other
>>> people. Otherwise I would have expected to see the first example in
>>> the book
>>> use query parser. So what I'm not quite sure is how come the norm
>>> is using
>>> the direct queries.
>
>> Highlighting and QueryParser aren't related.  How you build or
>> generate the Query object is irrelevant to the Highlighter.
>>
>> It is true that in my applications, use of QueryParser is only a
>> small piece of how the Query gets built and in one project I've
>> created an entirely different and custom expression parser (for
>> legacy syntax compatibility reasons, as well as to support
>> sophisticated SpanQuery constructions).
>>
>> I believe the first example in Lucene in Action does use QueryParser,
>> the Searcher.java code in Chapter 1.
>>
>> 	Erik
>
> Hi Erik, from my point of view Highlighter and QueryParser ARE  
> related when
> talking about the process of highlighting. If you've generated your  
> Query
> through the use of QueryParser then you really must call the  
> Query.Rewrite
> before you pass the query to the scorer which goes on to the  
> highlighter.

Again, it doesn't matter about how the Query was created.  It is  
important to call rewrite on it to have queries that expand to expand  
themselves into primitive queries such that the exact terms can be  
extracted by the Highlighter.  For example, if you create a  
WildcardQuery yourself without the parser, you'll still need to call  
rewrite to have the terms expanded.

> When I said the first example what I meant was the first example in  
> section
> 8.7 "Highlighting query terms". It looks like a very simple example  
> but for
> me it was not a realistic example. When I see these things I want  
> to cut and
> paste and use as a starting point but in this case it didn't do what I
> expected and I ended up confused..

That's a fair critique.  I agree that this example was not entirely  
realistic for cut-and-paste, and the coverage of having to do a  
rewrite was barely mentioned in the text.  I'll note this for  
improvement in the 2nd edition (which hopefully will get started in  
the next couple of months).

> Please take my comments as constructive feedback solely from my  
> perspective.
> Please do not take it as criticism of your excellent book!

Thank you!

	Erik


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


RE: Highlighter

Posted by Gwyn Carwardine <gw...@carwardine.net>.
>> Yes I think you're right. On reading the "lucene in action" chapted on
>> highlighting I found it squirreled in the middle of the text. I get  
>> the
>> feeling that whilst I have so far found query parser to be the primary
>> method of building queries that this is not ht eprimary method used  
>> by other
>> people. Otherwise I would have expected to see the first example in  
>> the book
>> use query parser. So what I'm not quite sure is how come the norm  
>> is using
>> the direct queries.

>Highlighting and QueryParser aren't related.  How you build or  
>generate the Query object is irrelevant to the Highlighter.
>
>It is true that in my applications, use of QueryParser is only a  
>small piece of how the Query gets built and in one project I've  
>created an entirely different and custom expression parser (for  
>legacy syntax compatibility reasons, as well as to support  
>sophisticated SpanQuery constructions).
>
>I believe the first example in Lucene in Action does use QueryParser,  
>the Searcher.java code in Chapter 1.
>
>	Erik

Hi Erik, from my point of view Highlighter and QueryParser ARE related when
talking about the process of highlighting. If you've generated your Query
through the use of QueryParser then you really must call the Query.Rewrite
before you pass the query to the scorer which goes on to the highlighter.

When I said the first example what I meant was the first example in section
8.7 "Highlighting query terms". It looks like a very simple example but for
me it was not a realistic example. When I see these things I want to cut and
paste and use as a starting point but in this case it didn't do what I
expected and I ended up confused..

Please take my comments as constructive feedback solely from my perspective.
Please do not take it as criticism of your excellent book!

-Gwyn



---------------------------------------------------------------------
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


Re: Highlighter

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 24, 2006, at 5:43 PM, Gwyn Carwardine wrote:

> Yes I think you're right. On reading the "lucene in action" chapted on
> highlighting I found it squirreled in the middle of the text. I get  
> the
> feeling that whilst I have so far found query parser to be the primary
> method of building queries that this is not ht eprimary method used  
> by other
> people. Otherwise I would have expected to see the first example in  
> the book
> use query parser. So what I'm not quite sure is how come the norm  
> is using
> the direct queries.

Highlighting and QueryParser aren't related.  How you build or  
generate the Query object is irrelevant to the Highlighter.

It is true that in my applications, use of QueryParser is only a  
small piece of how the Query gets built and in one project I've  
created an entirely different and custom expression parser (for  
legacy syntax compatibility reasons, as well as to support  
sophisticated SpanQuery constructions).

I believe the first example in Lucene in Action does use QueryParser,  
the Searcher.java code in Chapter 1.

	Erik


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


Re: Highlighter

Posted by ms...@aol.com.
Yes, that is correct...you need to rewrite the query. I was actually the main developer for the 1.5 .NET port, so if you come across any issues, please email me at my hotmail address which I check more often than this one...
 
-Joe Langley
 
-----Original Message-----
From: Gwyn Carwardine <gw...@carwardine.net>
To: java-user@lucene.apache.org
Sent: Tue, 24 Jan 2006 22:43:53 -0000
Subject: RE: Highlighter


Yes I think you're right. On reading the "lucene in action" chapted on
highlighting I found it squirreled in the middle of the text. I get the
feeling that whilst I have so far found query parser to be the primary
method of building queries that this is not ht eprimary method used by other
people. Otherwise I would have expected to see the first example in the book
use query parser. So what I'm not quite sure is how come the norm is using
the direct queries.

it helped, thanks

-Gwyn

-----Original Message-----
From: Koji Sekiguchi [mailto:koji.sekiguchi@m4.dion.ne.jp] 
Sent: 24 January 2006 22:23
To: java-user@lucene.apache.org
Subject: RE: Highlighter

I've never used .net port of Lucene and highlighter,
but I believe we have to call Query.rewrite()
to expand the query expression when using
phrasequery, wildcardquery, regexquery and fuzzyquery,
then pass it to highlighter.

hope this helps,

Koji


> -----Original Message-----
> From: Gwyn Carwardine [mailto:gwyn@carwardine.net]
> Sent: Wednesday, January 25, 2006 6:28 AM
> To: java-user@lucene.apache.org
> Subject: Highlighter
> 
> 
> I'm using the .net port of highlighter (1.5) and I notice it doesn't
> highlight range or prefix queries.. Is this consistent with the java
> version? Only I note my standard reference of www.lucenebook.com seems to
> support highlighting.. is this using that same highlighter 
> version (couldn't
> find any verison info on the lucene apache site)
> 
> TIA
> 
> -Gwyn
> 
> 
> ---------------------------------------------------------------------
> 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



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

RE: Highlighter

Posted by Gwyn Carwardine <gw...@carwardine.net>.
Yes I think you're right. On reading the "lucene in action" chapted on
highlighting I found it squirreled in the middle of the text. I get the
feeling that whilst I have so far found query parser to be the primary
method of building queries that this is not ht eprimary method used by other
people. Otherwise I would have expected to see the first example in the book
use query parser. So what I'm not quite sure is how come the norm is using
the direct queries.

it helped, thanks

-Gwyn

-----Original Message-----
From: Koji Sekiguchi [mailto:koji.sekiguchi@m4.dion.ne.jp] 
Sent: 24 January 2006 22:23
To: java-user@lucene.apache.org
Subject: RE: Highlighter

I've never used .net port of Lucene and highlighter,
but I believe we have to call Query.rewrite()
to expand the query expression when using
phrasequery, wildcardquery, regexquery and fuzzyquery,
then pass it to highlighter.

hope this helps,

Koji


> -----Original Message-----
> From: Gwyn Carwardine [mailto:gwyn@carwardine.net]
> Sent: Wednesday, January 25, 2006 6:28 AM
> To: java-user@lucene.apache.org
> Subject: Highlighter
> 
> 
> I'm using the .net port of highlighter (1.5) and I notice it doesn't
> highlight range or prefix queries.. Is this consistent with the java
> version? Only I note my standard reference of www.lucenebook.com seems to
> support highlighting.. is this using that same highlighter 
> version (couldn't
> find any verison info on the lucene apache site)
> 
> TIA
> 
> -Gwyn
> 
> 
> ---------------------------------------------------------------------
> 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



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


Re: Highlighter

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 25, 2006, at 12:50 AM, Ravi wrote:
> I am also have some problem with highlighter when I want to highlight
> specific field in the lucene it is not working....

Improvements were made to the Highlighter in December to add field- 
specific highlighting capability.  Here's the svn log:

-----
r351504 | mharwood | 2005-12-01 17:18:33 -0500 (Thu, 01 Dec 2005) | 1  
line

Added support for field-specific highlighting which respects the  
fieldnames found in queries. Pass a field name to the QueryScorer in  
order to only select those field's query terms for highlighting.  
Updated JUnit tests too.
------

You will need to rebuild the Highlighter (contrib/highlighter in  
Subversion) to get this change, and the Highlighter code depends on  
the trunk version of Lucene.  You'll either need to upgrade to the  
latest trunk code of Lucene and the Highlighter, or figure out how to  
backport the Highlighter changes to a 1.4.3 compatible version.  My  
recommendation is to upgrade to the trunk of Lucene and Highlighter.

	Erik




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


RE: Highlighter

Posted by Ravi <ra...@siti.com>.
Hi ,

I am also have some problem with highlighter when I want to highlight
specific field in the lucene it is not working....


Thanks

Ravi Kumar Jaladanki

-----Original Message-----
From: Koji Sekiguchi [mailto:koji.sekiguchi@m4.dion.ne.jp] 
Sent: Wednesday, January 25, 2006 3:53 AM
To: java-user@lucene.apache.org
Subject: RE: Highlighter

I've never used .net port of Lucene and highlighter,
but I believe we have to call Query.rewrite()
to expand the query expression when using
phrasequery, wildcardquery, regexquery and fuzzyquery,
then pass it to highlighter.

hope this helps,

Koji


> -----Original Message-----
> From: Gwyn Carwardine [mailto:gwyn@carwardine.net]
> Sent: Wednesday, January 25, 2006 6:28 AM
> To: java-user@lucene.apache.org
> Subject: Highlighter
> 
> 
> I'm using the .net port of highlighter (1.5) and I notice it doesn't
> highlight range or prefix queries.. Is this consistent with the java
> version? Only I note my standard reference of www.lucenebook.com seems to
> support highlighting.. is this using that same highlighter 
> version (couldn't
> find any verison info on the lucene apache site)
> 
> TIA
> 
> -Gwyn
> 
> 
> ---------------------------------------------------------------------
> 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


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


RE: Highlighter

Posted by Koji Sekiguchi <ko...@m4.dion.ne.jp>.
I've never used .net port of Lucene and highlighter,
but I believe we have to call Query.rewrite()
to expand the query expression when using
phrasequery, wildcardquery, regexquery and fuzzyquery,
then pass it to highlighter.

hope this helps,

Koji


> -----Original Message-----
> From: Gwyn Carwardine [mailto:gwyn@carwardine.net]
> Sent: Wednesday, January 25, 2006 6:28 AM
> To: java-user@lucene.apache.org
> Subject: Highlighter
> 
> 
> I'm using the .net port of highlighter (1.5) and I notice it doesn't
> highlight range or prefix queries.. Is this consistent with the java
> version? Only I note my standard reference of www.lucenebook.com seems to
> support highlighting.. is this using that same highlighter 
> version (couldn't
> find any verison info on the lucene apache site)
> 
> TIA
> 
> -Gwyn
> 
> 
> ---------------------------------------------------------------------
> 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