Home | About | Sematext search-lucene.com search-hadoop.com
 Search Lucene and all its subprojects:

Switch to Threaded View
Lucene, mail # user - org.apache.lucene.search.highlight.Highlighter


Copy link to this message
-
RE: org.apache.lucene.search.highlight.Highlighter
Karthik N S 2004-05-25, 08:52
Hey
Lucene-Developers Finally found the problem with Highlighter SRC

The Search SRC using search.highlight.Highlighter depends on
storage of the HTML Content  (FIELD_NAME) while Indexing,

If the Content is Stored as

     FileInputStream is = new FileInputStream(File);
     reader = new BufferedReader(new InputStreamReader(is));
     doc.add(Field.Text("contents", reader));

then the search.highlight.Highlighter raises a null Pointer Exception on the
FIELD_NAME  "Content"
java.lang.NullPointerException
at search.highlight.Highlighter.getBestDocFragments(Highlighter.java:141)
at search.highlight.Highlighter.getBestFragments(Highlighter.java:80)
at search.highlight.Highlighter.getBestFragments(Highlighter.java:328)
at org.apache.lucene.demo.Search.searchIndex1(Search.java:84)
atorg.apache.lucene.demo.Search.main(Search.java:107)
But if u use

       Field ff = new Field("contents", proceStr, true, true, true);

      (Where proceStr = Contents of HTML)

Then in such case
   search.highlight.Highlighter   returns a correct Search + Highlighter
(bold) implementation of the Indexed segment.

Now Please some body who is
mature more enough to improve this code please do.
Peace at last      ............. :)
Karthik
-----Original Message-----
From: Erik Hatcher [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 24, 2004 10:40 PM
To: Lucene Users List
Subject: Re: org.apache.lucene.search.highlight.Highlighter
On May 24, 2004, at 5:11 AM, Karthik N S wrote:
> I was broswing thru CVS  and found the SRC for  "IndexWriter2.java
> written
> by Ivaylo Zlatev on feb 2002,

Where do you see this?  It is not in the current CVS that I can tell.

> The Tecnique of using RAMDirectory, my Query has really become faster
> access
> ,
> So hence plan to use it  during Indexing process also.

I'm confused by what you're after.  You can index into a RAMDirectory,
no problem, and then persist it to a FSDirectory when you are done with
the current codebase.

Erik
---------------------------------------------------------------------
---------------------------------------------------------------------