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 daniel susanto <da...@yahoo.com> on 2009/04/18 17:19:04 UTC
Indexing Complex XML
Hi,
I need advise or example to index complex XML file, I mean the XML note just in one level node but more than one. for example indexing rss or atom.
thx b4.
Daniel Susanto
http://susantodaniel.wordpress.com
Re: Indexing Complex XML
Posted by Erick Erickson <er...@gmail.com>.
Lucene is an *engine*, not an application. *You* have to process the
XML, decide what the structure of your index is and index the data. There
are many
XML parser options, this is just straight Java code. You'll decide
what's relevant, and add the contents of the relevant elements to a Lucene
document
then add that to your index.
Similarly for searching.
So, say you have the following simple XML doc
<root>
<ele1>ele 1 text</ele1>
<ele2>ele 2 text</ele2>
</root>
You'd have to parse that text, then, say, add (semi-pseudo-code)
Document doc = new Document()
doc.add(new Field("ele1field", "ele 1 text", StoreOPtion, IndexOption);
doc.add(new Field("ele2field", "ele 2 text", StoreOption, IndexOption);
writer.add(doc);
Then at search time you'd form your queries on "ele1field" and ele2field".
HTH
Erick
On Sat, Apr 18, 2009 at 11:19 AM, daniel susanto <da...@yahoo.com>wrote:
> Hi,
>
> I need advise or example to index complex XML file, I mean the XML note
> just in one level node but more than one. for example indexing rss or atom.
>
> thx b4.
> Daniel Susanto
> http://susantodaniel.wordpress.com
>
>
>
Re: Indexing Complex XML
Posted by Paul Libbrecht <pa...@activemath.org>.
daniel,
have a look at solr DIH, it has prebuilt tools to do just that.
http://wiki.apache.org/solr/DataImportHandler
This bases on solr which is a web-application that bases on lucene.
It does not need imperatively to be run as a web application though,
it can be embedded.
paul
Le 18-avr.-09 à 17:19, daniel susanto a écrit :
> Hi,
>
> I need advise or example to index complex XML file, I mean the XML
> note just in one level node but more than one. for example indexing
> rss or atom.
>
> thx b4.
> Daniel Susanto
> http://susantodaniel.wordpress.com
>
>