lucene search sentence

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

lucene search sentence

anton feldmann
Hi

I wrote a Indexer which is indexing all the contents of a text and the
sentence are seperated in an other Document.

"Document document = new Document(new Field ("contents", reader ));
           
        StringTokenizer token = new StringTokenizer(contents.replaceAll(". ", "\\.x\\") , "\\.x\\");
while(token.hasMoreTokens()){
        Document doc = new Document();
      doc.add(new Field ("sentence", token.nextToken(),Field.Store.YES, Field.Index.TOKENIZED) );
}"

1) How do I write a Lucene Search and display all the hits in an
document?
2) How do I display the sentence the hit is in? and color the hit.
3) How do I display the sentence before and after the sentence the hit
is in?

Cherrs

anton


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: lucene search sentence

Robert Engels
Ask the question on the lucene users list, not the dev-list.

And, Read a book. Read the javadoc. Read the samples.

-----Original Message-----
From: Anton Feldmann [mailto:[hidden email]]
Sent: Thursday, April 27, 2006 10:05 AM
To: [hidden email]; [hidden email]
Subject: lucene search sentence


Hi

I wrote a Indexer which is indexing all the contents of a text and the
sentence are seperated in an other Document.

"Document document = new Document(new Field ("contents", reader ));

        StringTokenizer token = new StringTokenizer(contents.replaceAll(".
", "\\.x\\") , "\\.x\\");
while(token.hasMoreTokens()){
        Document doc = new Document();
      doc.add(new Field ("sentence", token.nextToken(),Field.Store.YES,
Field.Index.TOKENIZED) );
}"

1) How do I write a Lucene Search and display all the hits in an
document?
2) How do I display the sentence the hit is in? and color the hit.
3) How do I display the sentence before and after the sentence the hit
is in?

Cherrs

anton


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]