Hi Constantin and others,
Thanks very much for the reply.
The code fragment works.
thanks
Varun
On Wed, Mar 19, 2008 at 12:42 PM, Constantin Radchenko
<[EMAIL PROTECTED]> wrote:
> Try this :
>
> for (Iterator iter = reader.getFieldNames(FieldOption.ALL).iterator();
> iter.hasNext();) {
>
You are asking for a new iterator each time around the loop - you'll just be
printing the first field forever.
- Original Message
From: varun sood <[EMAIL PROTECTED]>
To: java-user@lucene.apache.org
Sent: Wednesday, 19 March, 2008 4:26:39 PM
Subject: Re: IndexReader ge
Try this :
for (Iterator iter = reader.getFieldNames(FieldOption.ALL).iterator();
iter.hasNext();) {
String fieldName = (String)iter.next();
}
Your code creates iterator each time when you call next()
Also, if your method out.print() gets String as parameter, casting is
redundan
Hi Shai,
The code I pasted is not working.. sorry abt that..
The code which is working is ..
Collection c = ir.getFieldNames(IndexReader.FieldOption.ALL);
int i = 0;
while (c.iterator().hasNext()) {
out.print(c.iterator().next(););
i++;
}
This hangs my machine for minutes minutes on
Can you give an example of the output?
What does out.print() do? Does it print spaces between records on new-lines?
On Wed, Mar 19, 2008 at 3:17 PM, varun sood <[EMAIL PROTECTED]> wrote:
> Hi All,
> Can someone please guide me on how to use IndexReader's
> getFieldNames() method properly?
> I wa
Hi All,
Can someone please guide me on how to use IndexReader's
getFieldNames() method properly?
I want to get all the filed names in the index. Currently I am getitng
it via Document object but that not wt i want.
I am implementing the code below and what I get is a very long string
of character