You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Bharani <bh...@yahoo.com> on 2007/11/30 12:19:29 UTC

How to get Solr Unique Key while doing TermEnum

Hi,

In order to extract the Term Dictionary of the indexed document i am doing
this

IndexReader indexReader = IndexReader.open(indexDir);
	    terms = indexReader.terms(new Term("description_t", ""));
	    while (terms.next()){
		    if("description_t".equals(terms.term().field())){
		    	MultipleTermPositions mt=new MultipleTermPositions(indexReader,new
Term[]{terms.term()});
		    	while(mt.next()){
		    		System.out.println("Document Id="+mt.doc()+" for
term="+terms.term().text() + " Frequency "+mt.freq());
		    	}
		    }
	    }
This gives me the document id of lucene but i would like to get the Solr
Unique Id. Is there an api that would give me the id without loading the
entire document?

Thanks
Bharani
-- 
View this message in context: http://www.nabble.com/How-to-get-Solr-Unique-Key-while-doing-TermEnum-tf4902164.html#a14042468
Sent from the Solr - Dev mailing list archive at Nabble.com.


Re: How to get Solr Unique Key while doing TermEnum

Posted by Yonik Seeley <yo...@apache.org>.
It takes a bit of memory, but you could use the FieldCache for this.

-Yonik

On Nov 30, 2007 6:19 AM, Bharani <bh...@yahoo.com> wrote:
>
> Hi,
>
> In order to extract the Term Dictionary of the indexed document i am doing
> this
>
> IndexReader indexReader = IndexReader.open(indexDir);
>             terms = indexReader.terms(new Term("description_t", ""));
>             while (terms.next()){
>                     if("description_t".equals(terms.term().field())){
>                         MultipleTermPositions mt=new MultipleTermPositions(indexReader,new
> Term[]{terms.term()});
>                         while(mt.next()){
>                                 System.out.println("Document Id="+mt.doc()+" for
> term="+terms.term().text() + " Frequency "+mt.freq());
>                         }
>                     }
>             }
> This gives me the document id of lucene but i would like to get the Solr
> Unique Id. Is there an api that would give me the id without loading the
> entire document?
>
> Thanks
> Bharani
> --
> View this message in context: http://www.nabble.com/How-to-get-Solr-Unique-Key-while-doing-TermEnum-tf4902164.html#a14042468
> Sent from the Solr - Dev mailing list archive at Nabble.com.
>
>