lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: Multiphrase Query in Lucene 4.3
Date Thu, 26 Sep 2013 09:25:11 GMT
I use the code below to do something like this.  Not exactly what you
want but should be easy to adapt.


public List<String> findTerms(IndexReader _reader,
                              String _field) throws IOException {
  List<String> l = new ArrayList<String>();
  Fields ff = MultiFields.getFields(_reader);
  Terms trms = ff.terms(_field);
  TermsEnum te = trms.iterator(null);
  BytesRef br;
  while ((br = te.next()) != null) {
    l.add(br.utf8ToString());
  }
  return l;
}

--
Ian.

On Wed, Sep 25, 2013 at 3:04 PM, VIGNESH S <vigneshklncit@gmail.com> wrote:
> Hi,
>
> In the Example of Multiphrase Query it is mentioned
>
> "To use this class, to search for the phrase "Microsoft app*" first use
> add(Term) on the term "Microsoft", then find all terms that have "app" as
> prefix using IndexReader.terms(Term), and use MultiPhraseQuery.add(Term[]
> terms) to add them to the query"
>
>
> How can i replicate the Same in Lucene 4.3 since IndexReader.terms(Term) is
> no more used
>
> --
> Thanks and Regards
> Vignesh Srinivasan

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


Mime
View raw message