That certainly works if the intent is to grab the entire file. If all you want is that particular line to be returned in the search then that's not going to work.
Let's say the files was made up of a million lines and the text was stored in the index (I know, absurd). When grabbing the Document from a search, you don't necessarily want to grab all the lines. Also when you get the document, how do you know which Field contained the line you wanted? Roy On Fri, Aug 1, 2008 at 9:59 AM, ನಾಗೇಶ್ ಸುಬ್ರಹ್ಮಣ್ಯ (Nagesh S) < [EMAIL PROTECTED]> wrote: > > Why should each line be a Document ? If there is a single document having > each line as a Field, then the search would result in a single Document as > a > 'hit' not the individual lines matching it. Is this right ? > > Nagesh > > On Fri, Aug 1, 2008 at 7:21 PM, <[EMAIL PROTECTED]> wrote: > > > Hello Brittany, > > > > I think the easiest thing for you to do is make each line a Document. > You > > might want a FileName and LineNumber field on top of a "Text" field, this > > way if you need to gather all the lines of your File back together again > > you > > can do a search on the FileName. > > > > So in your case: > > > > Document 1 > > FileName: [the file] > > LineNumber: 1 > > Text: I like apples > > Document 2 > > ...etc > > > > Regards, > > Roy > > > > On Fri, Aug 1, 2008 at 9:28 AM, Brittany Jacobs < > [EMAIL PROTECTED] > > >wrote: > > > > > Just trying to grasp the concept. > > > > > > > > > > > > I want to search a text file where each line is a separate item to be > > > searched. When text it entered by the user, I want to return all the > > lines > > > in which that text appears. > > > > > > For example, if the text file has: > > > > > > I like apples. > > > > > > I went to the store. > > > > > > I bought an apple. > > > > > > > > > > > > If the user searches "apple", I want it to return the first and third > > > sentences. > > > > > > > > > > > > Is each sentence a Token? Is the user input going to be a QueryParser? > > > How > > > should I read in the file so that each line of text is a token to > search? > > > > > > > > > > > > Thanks in advance. > > > > > > > > > > > > > > > > > > > > > > > > Brittany Jacobs > > > > > > Java Developer > > > > > > JBManagement, Inc. > > > > > > 12 Christopher Way, Suite 103 > > > > > > Eatontown, NJ 07724 > > > > > > ph: 732-542-9200 ext. 229 > > > > > > fax: 732-380-0678 > > > > > > email: <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] > > > > > > > > > > > > > > >