Results 1 to 2 of 2
  1. #1
    noorws is offline Member
    Join Date
    Nov 2009
    Rep Power

    Default Searching index with special chars


    I am indexing the data with option "Field.Index.NOT_ANALYZED" so that I can fetch it later.

    But If i search the index data with the special chars then expected result wont come up. I am escaping the search string as well :(

    -- Code Snapshot --
    Java Code:
    doc.add(new Field("id", "a+b-c", Field.Store.YES,Field.Index.NOT_ANALYZED));
    Java Code:
    searcher = new IndexSearcher(IdxPath);
    QueryParser queryParser = new QueryParser("id",
    					new StandardAnalyzer());
    String escapedString = QueryParser.escape(searchStr);
    Query query = queryParser.parse(escapedString);
    Hits hits =;
    query.toString() shows the "b c" (Without the Quotes) and this is surprising for me..

    Any help/suggestion will be appreciated.


  2. #2
    peliukasss is offline Member
    Join Date
    Feb 2010
    Rep Power


    If you want to get text with quotes, first you need to give that text with quotes becouse now query parsing only text between quotes. Try this:

    doc.add(new Field("id", "\"a+b-c\"", Field.Store.YES,Field.Index.NOT_ANALYZED));

Similar Threads

  1. filter special chars
    By Strubbl in forum Lucene
    Replies: 0
    Last Post: 08-17-2009, 11:23 AM
  2. How to index the special characters in Lucene
    By talktoudaykumar in forum Lucene
    Replies: 2
    Last Post: 04-23-2009, 08:51 AM
  3. Replacing the chars within a string.
    By Mayur in forum New To Java
    Replies: 2
    Last Post: 03-27-2009, 05:00 AM
  4. Searching for Microsoft special characters
    By Tim McDaniel in forum Eclipse
    Replies: 2
    Last Post: 02-24-2009, 04:11 PM
  5. chars
    By whosadork in forum New To Java
    Replies: 6
    Last Post: 10-03-2008, 10:40 PM

Tags for this Thread

Posting Permissions

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