On Wed, 2005-01-12 at 01:13 -0800, Swati Singhal wrote:
> I have a txt file, which contains the path to jpg
> files. These jpg files are organized into folders. 
> My search is limited to searching only this txt file.
> 
> So when i search based on a folder name, a match is
> found in the txt file, but i want it to return me the
> entire line as a search result and not the document
> name. (which is the txt file)
> 
> How can I do that using Lucene?
> I have already built the index by giving the txt file
> as an input to build the index.
> 
> If this is not possible, please tell me a way to parse
> jpg files to form an index file.

Lucene might be overkill in this situation if you don't need it's more
advanced text searching facilities, i.e. you're only searching for exact
matches for folder names and never need to tokenize the search term.

If you still want to use Lucene the approach I would take would be to
have one Document in Lucene per folder name in the text file. Within
this document you store the list of JPG files, it might not even be
necessary to store them in separate fields from the sounds of your
requirements.

Start up parsing the text file and each time you find a new folder name
create a new Document. Assuming the entries in the file are of the form:

/folder-name/filename.jpg

It should be fairly straightforward to do using regular expressions.

If the text document is an unnecessary step I would follow the solution
described in Erik's reply.


-- 
Miles Barr <[EMAIL PROTECTED]>
Runtime Collective Ltd.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to