Results 1 to 2 of 2
  1. #1
    vaibhav.arya is offline Member
    Join Date
    Aug 2010
    Rep Power

    Unhappy Lucene serch (no of occurrences)

    Hi All,

    I am building index & search service in lucene. I'm newbi to lucene and have some query.
    I have no problem in indexing and use SimpleAnalyzer to index text files. Now, in searching, I need to write searched data in text file in following format:

    <Path of File containing text> <Rank of the file> <No. of occurrences of text in file>
    To generate above format, I'm facing difficulty in calculating number of occurrences in particular file. As long as, I search for single text (without space or any special character), the search works fine, but if I use multiple words in query or special character even dot(.), then no. of occurrences fail me.

    I'm using SimpleAnalyzer in both index and search. Is there any particular analyzer to get it done?

    I am adding file reader in document as follows:

    doc.add(new Field("path", f.getPath(), Field.Store.YES, Field.Index.UN_TOKENIZED));

    doc.add(new Field("contents", new FileReader(f),Field.TermVector.WITH_POSITIONS_OFFS ETS));

    Kindly suggest me in this regard.

    Thanks in advance.

    Vaibhav Kr Arya

  2. #2
    skollapa is offline Member
    Join Date
    Jan 2011
    Rep Power

Similar Threads

  1. Apache Lucene
    By dkarthiin in forum Lucene
    Replies: 0
    Last Post: 03-25-2010, 12:25 PM
  2. use Math.random and then count occurrences
    By iliak67 in forum New To Java
    Replies: 17
    Last Post: 11-16-2009, 04:57 PM
  3. Number of occurrences in a int[ ]
    By random0munky in forum New To Java
    Replies: 10
    Last Post: 10-10-2009, 10:22 PM
  4. Replies: 20
    Last Post: 05-14-2008, 09:42 AM

Posting Permissions

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