You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by starz10de <fa...@yahoo.com> on 2007/03/03 17:06:18 UTC
Re: [ANN] Printing lucene index content
karl wettin-3 wrote:
>
>
> 3 mar 2007 kl. 13.54 skrev starz10de:
>
>> How i can print the index content in order to use them for some
>> application.
>> I did use
>> TermEnum terms=ir.terms();
>> while (terms.next()) {
>> System.out.println(terms.term().text());
>> }
>>
>> I still need to print the document id and the term frequency inside
>> each
>> document.
>
> See TermDocs:
>
> <http://lucene.apache.org/java/docs/api/org/apache/lucene/index/
> TermDocs.html>
>
> --
> karl
>
> I did try this but it is still not working
>
> IndexReader ir = IndexReader.open("index");
>
> TermDocs dok=ir.termDocs();
> while (dok.next()) {
> System.out.println("doc nr: "+dok.doc()+ " term freq
> :"+dok.freq());
> }
>
> any help
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Printing-lucene-index-content-tf3338412.html#a9286625
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: [ANN] Printing lucene index content
Posted by starz10de <fa...@yahoo.com>.
karl wettin-3 wrote:
>
>
> 3 mar 2007 kl. 23.18 skrev starz10de:
>
>>>>>
>>>>> IndexReader ir = IndexReader.open("index");
>>>>>
>>>>> TermEnum terms=ir.terms();
>>>>>
>>>>> TermEnum termEnum = ir.getReader().terms();
>>>>> while (termEnum.next()) {
>>>>> TermDocs dok = ir.getReader().termDocs();
>>>>> dok.seek(termEnum);
>>>>> while (dok.next()) {
>>>>> System.out.println(dok.doc() + "\t" + dok.freq() +
>>>>> "\t" +
>>>>> termEnum.term());
>>>>> }
>>>>> }
>
>>> my text file is " hello every one"
>>> i successed to display the text file but with :
>>> -
>>> -
>>> modified:0eyulpzyg
>>> path:c:\test\1.txt
>>>
>>> which i don't need to access ,how i can avoid printing that.
>
> if (!"modified".equals(termEnum.term().field() && !"path".equals
> (termEnum.term().field()) {
>
> ?
>
> --
> karl
>
> hi karl,
>
> thank you very much !!!
> that what i wanted :)
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Printing-lucene-index-content-tf3338412.html#a9290735
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: [ANN] Printing lucene index content
Posted by karl wettin <ka...@gmail.com>.
3 mar 2007 kl. 23.18 skrev starz10de:
>>>>
>>>> IndexReader ir = IndexReader.open("index");
>>>>
>>>> TermEnum terms=ir.terms();
>>>>
>>>> TermEnum termEnum = ir.getReader().terms();
>>>> while (termEnum.next()) {
>>>> TermDocs dok = ir.getReader().termDocs();
>>>> dok.seek(termEnum);
>>>> while (dok.next()) {
>>>> System.out.println(dok.doc() + "\t" + dok.freq() +
>>>> "\t" +
>>>> termEnum.term());
>>>> }
>>>> }
>> my text file is " hello every one"
>> i successed to display the text file but with :
>> -
>> -
>> modified:0eyulpzyg
>> path:c:\test\1.txt
>>
>> which i don't need to access ,how i can avoid printing that.
if (!"modified".equals(termEnum.term().field() && !"path".equals
(termEnum.term().field()) {
?
--
karl
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: [ANN] Printing lucene index content
Posted by starz10de <fa...@yahoo.com>.
karl wettin-3 wrote:
>
>
> 3 mar 2007 kl. 22.31 skrev starz10de:
>
>>>
>>> hi Karl ,
>>>
>>> but the problem is that the getReader is not defined for type
>>> indexReader
>>> !!
>>>
>>> this is my code
>>>
>>> IndexReader ir = IndexReader.open("index");
>>>
>>> TermEnum terms=ir.terms();
>>>
>>> TermEnum termEnum = ir.getReader().terms();
>>> while (termEnum.next()) {
>>> TermDocs dok = ir.getReader().termDocs();
>>> dok.seek(termEnum);
>>> while (dok.next()) {
>>> System.out.println(dok.doc() + "\t" + dok.freq() + "\t" +
>>> termEnum.term());
>>> }
>>> }
>>>
>
>
> Just skip the getReader(). That code I gave you accessed the
> IndexReader from an aggregation.
>
> --
> karl
>
> Hi Karl,
>
> thanks alot for your kind help, just last simple question
> my text file is " hello every one"
> i successed to display the text file but with :
> -
> -
> modified:0eyulpzyg
> path:c:\test\1.txt
>
> which i don't need to access ,how i can avoid printing that.
>
>
> which i dont need to access.
>
> thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Printing-lucene-index-content-tf3338412.html#a9290367
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: [ANN] Printing lucene index content
Posted by karl wettin <ka...@gmail.com>.
3 mar 2007 kl. 22.31 skrev starz10de:
>>
>> hi Karl ,
>>
>> but the problem is that the getReader is not defined for type
>> indexReader
>> !!
>>
>> this is my code
>>
>> IndexReader ir = IndexReader.open("index");
>>
>> TermEnum terms=ir.terms();
>>
>> TermEnum termEnum = ir.getReader().terms();
>> while (termEnum.next()) {
>> TermDocs dok = ir.getReader().termDocs();
>> dok.seek(termEnum);
>> while (dok.next()) {
>> System.out.println(dok.doc() + "\t" + dok.freq() + "\t" +
>> termEnum.term());
>> }
>> }
>>
Just skip the getReader(). That code I gave you accessed the
IndexReader from an aggregation.
--
karl
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: [ANN] Printing lucene index content
Posted by starz10de <fa...@yahoo.com>.
karl wettin-3 wrote:
>
>
> 3 mar 2007 kl. 21.25 skrev starz10de:
>>> how i can implement aprioriIndex ?
>
> Oh sorry. That should just be your IndexReader.
>
> --
> karl
>
> hi Karl ,
>
> but the problem is that the getReader is not defined for type indexReader
> !!
>
> this is my code
>
> IndexReader ir = IndexReader.open("index");
>
> TermEnum terms=ir.terms();
>
> TermEnum termEnum = ir.getReader().terms();
> while (termEnum.next()) {
> TermDocs dok = ir.getReader().termDocs();
> dok.seek(termEnum);
> while (dok.next()) {
> System.out.println(dok.doc() + "\t" + dok.freq() + "\t" +
> termEnum.term());
> }
> }
>
> thnaks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Printing-lucene-index-content-tf3338412.html#a9289911
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: [ANN] Printing lucene index content
Posted by karl wettin <ka...@gmail.com>.
3 mar 2007 kl. 21.25 skrev starz10de:
>> how i can implement aprioriIndex ?
Oh sorry. That should just be your IndexReader.
--
karl
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: [ANN] Printing lucene index content
Posted by starz10de <fa...@yahoo.com>.
karl wettin-3 wrote:
>
>
> 3 mar 2007 kl. 17.06 skrev starz10de:
>
>>
>> I did try this but it is still not working
>>
>> IndexReader ir = IndexReader.open("index");
>>
>> TermDocs dok=ir.termDocs();
>> while (dok.next()) {
>> System.out.println("doc nr: "+dok.doc()+ " term freq
>> :"+dok.freq());
>> }
>
> TermEnum termEnum = aprioriIndex.getReader().terms();
> while (termEnum.next()) {
> TermDocs dok = aprioriIndex.getReader().termDocs();
> dok.seek(termEnum);
> while (dok.next()) {
> System.out.println(dok.doc() + "\t" + dok.freq() + "\t" +
> termEnum.term());
> }
> }
>
>
> --
> karl
>
> hi Karl ,
>
> how i can implement aprioriIndex ?
>
> thanks
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Printing-lucene-index-content-tf3338412.html#a9289319
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: [ANN] Printing lucene index content
Posted by karl wettin <ka...@gmail.com>.
3 mar 2007 kl. 17.06 skrev starz10de:
>
> I did try this but it is still not working
>
> IndexReader ir = IndexReader.open("index");
>
> TermDocs dok=ir.termDocs();
> while (dok.next()) {
> System.out.println("doc nr: "+dok.doc()+ " term freq
> :"+dok.freq());
> }
TermEnum termEnum = aprioriIndex.getReader().terms();
while (termEnum.next()) {
TermDocs dok = aprioriIndex.getReader().termDocs();
dok.seek(termEnum);
while (dok.next()) {
System.out.println(dok.doc() + "\t" + dok.freq() + "\t" +
termEnum.term());
}
}
--
karl
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org