lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wei Wang <welshw...@gmail.com>
Subject Re: DiskDocValuesFormat
Date Sat, 13 Apr 2013 17:03:27 GMT
Hi Adrien,

Thanks for your example. Really helpful!

Wei

On Sat, Apr 13, 2013 at 4:25 AM, Adrien Grand <jpountz@gmail.com> wrote:

> Hi Wei,
>
> On Sat, Apr 13, 2013 at 7:44 AM, Wei Wang <welshwang@gmail.com> wrote:
> > I am trying to use DiskDocValuesFormat for a particular
> > BinaryDocValuesField. It seems there is no good examples showing how to
> do
> > this. The only hint I got from various docs and forums is set some codec
> in
> > IndexWriter. Could someone give a few lines of code snippet and show how
> to
> > set DiskDocValuesFormat?
>
> Lucene42Codec can be extended to specify the doc values format to use
> on a per-field basis. For example:
>
> final Codec codec = new Lucene42Codec() {
>   final Lucene42DocValuesFormat memoryDVFormat = new
> Lucene42DocValuesFormat();
>   final DiskDocValuesFormat diskDVFormat = new DiskDocValuesFormat();
>   @Override
>   public DocValuesFormat getDocValuesFormatForField(String field) {
>     if ("dv_mem".equals(field)) {
>       // use Lucene42 for "dv_mem"
>       return memoryDVFormat;
>     } else {
>       // use Disk otherwise
>       return diskDVFormat;
>     }
>   }
> };
>
> Then just pass this Codec instance to your IndexWriterConfig.
>
> --
> Adrien
>
> ---------------------------------------------------------------------
> 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