lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Wang" <john.w...@gmail.com>
Subject Re: NIOFSDirectory
Date Thu, 04 Dec 2008 22:49:50 GMT
NIOFSDirectory.getDirectory simple calls the static method on the parent
class: FSDirectory.getDirectory.
Which returns an instance of FSDirectory.

IMO: NIOFSDirectory solves concurrent read problems, generally you don't
want concurrent writes.

-John

On Thu, Dec 4, 2008 at 2:44 PM, Glen Newton <glen.newton@gmail.com> wrote:

> Am I missing something here?
>
> Why not use:
>  IndexWriter writer = new IndexWriter(NIOFSDirectory.getDirectory(new
> File(filename), analyzer, true);
>
> Another question: is NIOFSDirectory to be used with IndexWriter? If
> no, could someone explain?
>
> thanks,
> -glen
>
>
> 2008/12/4 John Wang <john.wang@gmail.com>:
> > Thanks!
> > -John
> >
> > On Thu, Dec 4, 2008 at 2:16 PM, Yonik Seeley <yonik@apache.org> wrote:
> >
> >> Details in the bug:
> >> https://issues.apache.org/jira/browse/LUCENE-1451
> >>
> >> Use this constructor to create an instance of NIODirectory:
> >>
> >>  /** Create a new NIOFSDirectory for the named location.
> >>   *
> >>   * @param path the path of the directory
> >>   * @param lockFactory the lock factory to use, or null for the default.
> >>   * @throws IOException
> >>   */
> >>  public NIOFSDirectory(File path, LockFactory lockFactory) throws
> >> IOException {
> >>    super(path, lockFactory);
> >>  }
> >>
> >> -Yonik
> >>
> >>
> >> On Thu, Dec 4, 2008 at 5:08 PM, John Wang <john.wang@gmail.com> wrote:
> >> > That does not help. The File/path is not stored with the instance. It
> is
> >> in
> >> > a map FSDirectory keeps statically. Should subclasses of FSDirectory
> be
> >> > modifying the map?
> >> > This is not a question about how to subclass or customize FSDirectory.
> >> This
> >> > is more on how to use NIOFSDirectory class. I am hoping for a simply
> >> answer,
> >> > is what I am doing (setting the class name statically on system
> property)
> >> > the right way?
> >> >
> >> > -John
> >> >
> >> > On Thu, Dec 4, 2008 at 2:00 PM, Yonik Seeley <yonik@apache.org>
> wrote:
> >> >
> >> >> On Thu, Dec 4, 2008 at 4:32 PM, Glen Newton <glen.newton@gmail.com>
> >> wrote:
> >> >> > Sorry....what version are we talking about?  :-)
> >> >>
> >> >> The current development version of Lucene allows you to directly
> >> >> instantiate FSDirectory subclasses.
> >> >>
> >> >> -Yonik
> >> >>
> >> >>
> >> >> > thanks,
> >> >> >
> >> >> > Glen
> >> >> >
> >> >> > 2008/12/4 Yonik Seeley <yonik@apache.org>:
> >> >> >> On Thu, Dec 4, 2008 at 4:11 PM, John Wang <john.wang@gmail.com>
> >> wrote:
> >> >> >>> Hi guys:
> >> >> >>>    We did some profiling and benchmarking:
> >> >> >>>
> >> >> >>>    The thread contention on FSDIrectory is gone, and for
the set
> of
> >> >> queries
> >> >> >>> we are running, performance improved by a factor of 5
(to be
> >> >> conservative).
> >> >> >>>
> >> >> >>>    Great job, this is awesome, a simple change and made
a huge
> >> >> difference.
> >> >> >>>
> >> >> >>>    To get NIOFSDirectory installed, I didn't find any
> documentation
> >> >> >>> (doesn't mean there aren't any), after reading the code,
I
> resorted
> >> to:
> >> >> >>>
> >> >> >>>  static
> >> >> >>>  {
> >> >> >>>
> >> >> >>>
> >> >>
> >>
> System.setProperty("org.apache.lucene.FSDirectory.class",NIOFSDirectory.class.getName());
> >> >> >>>  }
> >> >> >>>   I am sure this is not the intended usage, as this is
really
> ugly.
> >> >> What is
> >> >> >>> the suggested usage?
> >> >> >>
> >> >> >> Instantiate NIOFSDirectory directly and pass it to the
> >> >> IndexReader.open()
> >> >> >>
> >> >> >> -Yonik
> >> >> >>
> >> >> >>
> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> >> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> >
> >> >> > -
> >> >> >
> >> >> >
> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> >> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >> >> >
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >>
> >
>
>
>
> --
>
> -
>
> ---------------------------------------------------------------------
> 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