Results 1 to 4 of 4
  1. #1
    ashkandaie is offline Member
    Join Date
    Aug 2010
    Posts
    2
    Rep Power
    0

    Default Highlighting with exact match

    I have a need to use lucene for snippet generation and highlighting. I would like to be able to find and highlight exact matches within a document. For example if one searches for "oracle 8i" I do not want to highlight the word oracle. I only want to highlight "oracle 8i" without the quotes. I am not using lucene as my search engine. Another system has already found the document and lucene is only responsible for highlighting and generating a snippet from the found text.

    When using the SimpleAnalyzer, lucene treats each word as a term and highlights every word individually. I do not get any matches using KeywordAnalyzer.

    Your help is greatly appreciated.

  2. #2
    roots's Avatar
    roots is offline Moderator
    Join Date
    Jan 2008
    Location
    Dallas
    Posts
    293
    Rep Power
    10

    Default

    Since you already have the results, wont it be simpler to use String.indexOf and String.replaceAll ?

    Let us know.
    dont worry newbie, we got you covered.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,370
    Blog Entries
    1
    Rep Power
    22

  4. #4
    ashkandaie is offline Member
    Join Date
    Aug 2010
    Posts
    2
    Rep Power
    0

    Default

    I agree that simplest way is the best way.

    The requirement is more than just hightlighting text.

    I also need to generate highlight fragments / snippets for the document which the highlighting extensions do.

Similar Threads

  1. Need help with highlighting text in a jcombobox
    By cjmartin in forum AWT / Swing
    Replies: 3
    Last Post: 08-09-2010, 06:21 PM
  2. Highlighting Multiple Selected Rows
    By bigj in forum New To Java
    Replies: 2
    Last Post: 02-07-2010, 06:31 PM
  3. Eclipse Syntax Highlighting
    By garrettgjb in forum Eclipse
    Replies: 1
    Last Post: 08-24-2009, 03:10 PM
  4. Replies: 1
    Last Post: 04-25-2009, 03:50 PM
  5. [SOLVED] Line Highlighting
    By Doctor Cactus in forum New To Java
    Replies: 2
    Last Post: 03-26-2009, 04:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •