lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karthik N S" <kart...@controlnet.co.in>
Subject RE: UNIQUE FIELD NAMES + SEARCH
Date Thu, 02 Dec 2004 12:06:39 GMT

Hi Erik


Apologies...


 Thx That src worked perfectly.

 Wow that really overcame a huge boulder for me.

 .......... :|

with regards
Karthik 

-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
Sent: Thursday, December 02, 2004 4:23 PM
To: Lucene Users List
Subject: Re: UNIQUE FIELD NAMES + SEARCH


On Dec 2, 2004, at 2:13 AM, Karthik N S wrote:
> I  My Index, I have a Filed Type KeyWord  ' FILE_NAME ' , It Captures 
> UNIQUE
> FOLDER NAME'S  [ Starts with  B1,B2,B3..... ]  During Indexing Process.
>
> Please Can SomeBody Tell me How to Display  ALL the FOLDER NAMES  from 
> the
> Field  'FILE_NAME'  With out any Search Word

I guess if you keep asking, someone will eventually answer :)

Here's an example I use to get all categories from the Lucene index 
that drives my blog at http://www.blogscene.org/erik

         Set categories = new TreeSet();

         IndexReader reader = IndexReader.open(indexDir);
         try {
             TermEnum terms = reader.terms(new Term("category", ""));
             while ("category".equals(terms.term().field())) {
                 categories.add(terms.term().text());

                 if (!terms.next()) {
                     break;
                 }
             }
         } finally {
             reader.close();
         }

IndexReader is enumerating all the terms in the "category" field 
(you'll use your filename field name instead).

> [ Can I use  'B* '  for Search Exclusively on the Field Type ]

Sure, but that would require that you walk every document returned from 
the search and pull its filename field.  This would be vastly slower 
than the above code that goes directly to the terms.

My apologies for not replying sooner on this.

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message