lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukai <lukai1...@gmail.com>
Subject Re: TermDocs
Date Tue, 09 Jul 2013 07:16:41 GMT
The code snippet you posted is implementation of MatchAllQuery , it only
gives you the live doc id in the specified segment. If you want to get
extra information about a term, eg. freq, payload, you need to do some
calculation. The good thing is FST is sorted, so you can maintain a list of
TermsEnum of your index reader, transverse the terms with "OR" logic like a
boolean query to read out <Field,Term> information. Here supposes you dont
care about the field information, you need to do some sort of aggregation
of the term information, eg, aggregating the term frequency of all field.


On Mon, Jul 8, 2013 at 11:19 PM, Yonghui Zhao <zhaoyonghui@gmail.com> wrote:

> I don't find an elegant solution.  reader.termDocs(null) returns
> AllTermDocs which doesn't exist in lucene 4.3.
>
>
> I use this piece of code
>
>     Bits liveDocs = reader.getLiveDocs();
>     for (int i = 0; i < reader.maxDoc(); ++i) {
>       if (liveDocs != null && !liveDocs.get(i)) {
>         continue;
>       }
>
> to replace
>
>        TermDocs termDocs = reader.termDocs(null);
>       while(termDocs.next())
>        {
>
>
> 2013/7/8 Ian Lea <ian.lea@gmail.com>
>
> > There's a fair chunk of info on TermDocs and friends in the migration
> > guide. http://lucene.apache.org/core/4_3_1/MIGRATE.html
> >
> > Does that cover your question?
> >
> >
> > --
> > Ian.
> >
> >
> > On Mon, Jul 8, 2013 at 12:32 PM, Yonghui Zhao <zhaoyonghui@gmail.com>
> > wrote:
> > > Hi,
> > >
> > > What's proper replacement of "TermDocs termDocs =
> reader.termDocs(null);“
> > > in lucene 4.x
> > > It seems reader.termDocsEnum(term) can't take null as a input
> parameter.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message