You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Shaw, James" <Ja...@intuit.com> on 2007/05/04 01:06:27 UTC

customizing index file name

Does anyone know how to fix the .cfs file name in an index directory?
The deletable and segments file names are always the same, but we have
observed that the .cfs file name changes each time you index a content
directory with some changes to the directory (some deleted files, added
files, etc).  How is the name computed anyways?  Is there any way to fix
it?  Could there be other files generated in an index directory after
optimization besides these 3 files (.cfs, deletable, and segments)?

RE: customizing index file name

Posted by "Shaw, James" <Ja...@intuit.com>.
It's not easy for us to have the installer team do that (it's a big
product).

We actually found IndexWriter.AddIndexes to do almost what we wanted:
just pass in empty list of IndexReader's, and customize the mergedName
to what we want it to be; I made extended IndexWriter to have this new
method.

        public virtual void MergeToName(string mergedName)
        {
            AddIndexes(new IndexReader[] { } );
            AddIndexes(new IndexReader[] { }, mergedName); // same as
current AddIndexes but lets mergedName passed in
        }

It has to have a merged segment with a random name (the 1st line), in
case the segment name is already mergedName.  Then it can merge to
mergedName.

Anways.  Just want to share this if anyone else needs constant .cfs name
in the generated index directory.

-----Original Message-----
From: Erick Erickson [mailto:erickerickson@gmail.com] 
Sent: Thursday, May 03, 2007 6:25 PM
To: java-user@lucene.apache.org
Subject: Re: customizing index file name

Oh, fix as in make constant, not fix as in broken <G>...

No, I don't know of any way to do this. Can your installer just
pack up everything in a directory?

Erick

On 5/3/07, Shaw, James <Ja...@intuit.com> wrote:
>
> I mean specifying the name of the .csf file, rather than letting
Lucene
> come up with a name by itself.
>
> I'm actually using Lucene.Net, and we pre-index during our build and
> want to include the index in the installer, but the installer can only
> reference named files, and it wouldn't work if the .csf changes every
> time we index.
>
> -----Original Message-----
> From: Erick Erickson [mailto:erickerickson@gmail.com]
> Sent: Thursday, May 03, 2007 4:56 PM
> To: java-user@lucene.apache.org
> Subject: Re: customizing index file name
>
> Uh, what do you mean "fix"? You shouldn't have to do anything
> with it at all. What behavior are you observing that you want
> to change and why?
>
> Erick
>
> On 5/3/07, Shaw, James <Ja...@intuit.com> wrote:
> >
> > Does anyone know how to fix the .cfs file name in an index
directory?
> > The deletable and segments file names are always the same, but we
have
> > observed that the .cfs file name changes each time you index a
content
> > directory with some changes to the directory (some deleted files,
> added
> > files, etc).  How is the name computed anyways?  Is there any way to
> fix
> > it?  Could there be other files generated in an index directory
after
> > optimization besides these 3 files (.cfs, deletable, and segments)?
> >
>
> ---------------------------------------------------------------------
> 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


Re: customizing index file name

Posted by Erick Erickson <er...@gmail.com>.
Oh, fix as in make constant, not fix as in broken <G>...

No, I don't know of any way to do this. Can your installer just
pack up everything in a directory?

Erick

On 5/3/07, Shaw, James <Ja...@intuit.com> wrote:
>
> I mean specifying the name of the .csf file, rather than letting Lucene
> come up with a name by itself.
>
> I'm actually using Lucene.Net, and we pre-index during our build and
> want to include the index in the installer, but the installer can only
> reference named files, and it wouldn't work if the .csf changes every
> time we index.
>
> -----Original Message-----
> From: Erick Erickson [mailto:erickerickson@gmail.com]
> Sent: Thursday, May 03, 2007 4:56 PM
> To: java-user@lucene.apache.org
> Subject: Re: customizing index file name
>
> Uh, what do you mean "fix"? You shouldn't have to do anything
> with it at all. What behavior are you observing that you want
> to change and why?
>
> Erick
>
> On 5/3/07, Shaw, James <Ja...@intuit.com> wrote:
> >
> > Does anyone know how to fix the .cfs file name in an index directory?
> > The deletable and segments file names are always the same, but we have
> > observed that the .cfs file name changes each time you index a content
> > directory with some changes to the directory (some deleted files,
> added
> > files, etc).  How is the name computed anyways?  Is there any way to
> fix
> > it?  Could there be other files generated in an index directory after
> > optimization besides these 3 files (.cfs, deletable, and segments)?
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

RE: customizing index file name

Posted by "Shaw, James" <Ja...@intuit.com>.
I mean specifying the name of the .csf file, rather than letting Lucene
come up with a name by itself.

I'm actually using Lucene.Net, and we pre-index during our build and
want to include the index in the installer, but the installer can only
reference named files, and it wouldn't work if the .csf changes every
time we index.

-----Original Message-----
From: Erick Erickson [mailto:erickerickson@gmail.com] 
Sent: Thursday, May 03, 2007 4:56 PM
To: java-user@lucene.apache.org
Subject: Re: customizing index file name

Uh, what do you mean "fix"? You shouldn't have to do anything
with it at all. What behavior are you observing that you want
to change and why?

Erick

On 5/3/07, Shaw, James <Ja...@intuit.com> wrote:
>
> Does anyone know how to fix the .cfs file name in an index directory?
> The deletable and segments file names are always the same, but we have
> observed that the .cfs file name changes each time you index a content
> directory with some changes to the directory (some deleted files,
added
> files, etc).  How is the name computed anyways?  Is there any way to
fix
> it?  Could there be other files generated in an index directory after
> optimization besides these 3 files (.cfs, deletable, and segments)?
>

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


Re: customizing index file name

Posted by Erick Erickson <er...@gmail.com>.
Uh, what do you mean "fix"? You shouldn't have to do anything
with it at all. What behavior are you observing that you want
to change and why?

Erick

On 5/3/07, Shaw, James <Ja...@intuit.com> wrote:
>
> Does anyone know how to fix the .cfs file name in an index directory?
> The deletable and segments file names are always the same, but we have
> observed that the .cfs file name changes each time you index a content
> directory with some changes to the directory (some deleted files, added
> files, etc).  How is the name computed anyways?  Is there any way to fix
> it?  Could there be other files generated in an index directory after
> optimization besides these 3 files (.cfs, deletable, and segments)?
>