You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Cyril Vidal <cy...@planetexml.com> on 2003/02/10 13:21:24 UTC
highlighting with Lucene
Hi,
I have a question about using highlighting with Lucene.
What I only want to do:
start from an xml document, by example:
<flower>
This is a beautiful yellow flower
</flower>
that I have first indexed in Lucene's index.
And when making a query such : flower:yellow
get an XML document from the following form:
<flower>
This is a beautiful <em>yellow</em> flower
</flower>
I don't want ANYsearch function, but just gain benefit from the highlight
function in Lucene.
At first glance, I think it's quite a easy task:
1°) Download the java classes from Maik Screiber, make the few modifications
on Lucene's code.
2°) Compile the Highlight Transformer java class from article
www.cocooncenter.org
3°) Write my sitemap, as written in the same article:
<map:transformer
logger="sitemap.transformer.highlight"
name="highlight"
pool-grow="2" pool-max="16" pool-min="2"
src="nl.datagram.cocoon.transformation.HighlightTransformer"/>
<map:match pattern="flora">
<map:generate type="file"
src="flora.xml"/>
<map:transform type="highlight" />
<map:serialize/>
</map:match>
And when pointing to the url:
http://localhost:8080/cocoon/flora?query=flower:yellow
I should have the desired document:
<flower>
This is a beautiful <em>yellow</em> flower
</flower>
Is this right, or highlighting is a much more difficult task?
Thanks for your response,
Cyril.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: highlighting with Lucene
Posted by Hugo Burm <hu...@xs4all.nl>.
Hi,
The steps you describe below are correct. But it may not be as easy as you
may wish.
Some points:
- The Cocooncenter article was written before Lucene support was integrated
in Cocoon.
Because of this:
- I did not use the indexer integrated in Cocoon, but used my own classes to
index xml files.
- I used my own xsp-logicsheet to pass the query to Lucene and get the
results back.
(you can download the classes and xsp sheet from the Cocooncenter site)
- The highlight transformer has to know about the terms of the query. If I
remember correctly, my xsp page creates a <query> tag out of the request,
and passes that to the transformer.
So the answer to your question: if you follow the article step by step, it
may work. If you want to mix with Lucene functionality integrated in Cocoon,
it will not.
Off course this is a bad thing. It should work as you describe below. So I
have to change this Tranformer in order to make it fit better in the current
Cocoon/Lucene environment. And meanwhile hope that the modifications of Maik
Schreiber are incorporated into the current branch of Lucene, so you could
skip recompiling Lucene
Hugo
-----Original Message-----
From: Cyril Vidal [mailto:cyril@planetexml.com]
Sent: Monday, February 10, 2003 1:21 PM
To: hugob@xs4all.nl; cocoon-users@xml.apache.org
Subject: highlighting with Lucene
Hi,
I have a question about using highlighting with Lucene.
What I only want to do:
start from an xml document, by example:
<flower>
This is a beautiful yellow flower
</flower>
that I have first indexed in Lucene's index.
And when making a query such : flower:yellow
get an XML document from the following form:
<flower>
This is a beautiful <em>yellow</em> flower
</flower>
I don't want ANYsearch function, but just gain benefit from the highlight
function in Lucene.
At first glance, I think it's quite a easy task:
1°) Download the java classes from Maik Screiber, make the few modifications
on Lucene's code.
2°) Compile the Highlight Transformer java class from article
www.cocooncenter.org
3°) Write my sitemap, as written in the same article:
<map:transformer
logger="sitemap.transformer.highlight"
name="highlight"
pool-grow="2" pool-max="16" pool-min="2"
src="nl.datagram.cocoon.transformation.HighlightTransformer"/>
<map:match pattern="flora">
<map:generate type="file"
src="flora.xml"/>
<map:transform type="highlight" />
<map:serialize/>
</map:match>
And when pointing to the url:
http://localhost:8080/cocoon/flora?query=flower:yellow
I should have the desired document:
<flower>
This is a beautiful <em>yellow</em> flower
</flower>
Is this right, or highlighting is a much more difficult task?
Thanks for your response,
Cyril.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>