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 Maxim Patramanskij <ma...@osua.de> on 2006/01/11 14:26:27 UTC

How to check, whether Index is optimized or not?

Hello dear Lucene users!

Is their an easy way to check, whether index is optimized or not?


Best regards,
 Max


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


Re: How to check, whether Index is optimized or not?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
A fully optimized index has only a single segment.  If you're using  
the non-compound index format you will be able to tell by looking at  
the segments file in the index where only one segment would be  
listed.   There are certainly programatic ways of telling too, but I  
don't have that detail handy at the moment.

	Erik


On Jan 11, 2006, at 8:26 AM, Maxim Patramanskij wrote:

> Hello dear Lucene users!
>
> Is their an easy way to check, whether index is optimized or not?
>
>
> Best regards,
>  Max
>
>
> ---------------------------------------------------------------------
> 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: How to check, whether Index is optimized or not?

Posted by Otis Gospodnetic <ot...@yahoo.com>.
I don't think so.  It's still a single segment.  Close the reader, and you still have only one segment.  You only have gaps from deleted docs, but I think that doesn't make the index unoptimized, even though optimizing such an index will remove the gaps.
 
 Otis


----- Original Message ----
From: Dave Kor <da...@gmail.com>
To: java-user@lucene.apache.org; Otis Gospodnetic <ot...@yahoo.com>
Sent: Thu 12 Jan 2006 03:26:46 AM EST
Subject: Re: How to check, whether Index is optimized or not?

Do we need to check if any documents are marked for deletion?

On 1/12/06, Otis Gospodnetic <ot...@yahoo.com> wrote:
> I don't think we have a public API for that, but the index is considered optimized when it contains only a single segment.
> Then, we could add the following to IndexReader:
>
> public boolean isOptimized() {
>   return segmentInfos.size() == 1;
> }
>
> I think that should do it.
>
> Otis
>
>
> ----- Original Message ----
> From: Maxim Patramanskij <ma...@osua.de>
> To: lucene-user@jakarta.apache.org
> Sent: Wed 11 Jan 2006 08:26:27 AM EST
> Subject: How to check, whether Index is optimized or not?
>
> Hello dear Lucene users!
>
> Is their an easy way to check, whether index is optimized or not?
>
>
> Best regards,
>  Max
>
>
> ---------------------------------------------------------------------
> 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
>
>


--
Research Assistant
Center for Information Mining and Extraction
School of Computing
National University of Singapore.




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


Re: How to check, whether Index is optimized or not?

Posted by Dave Kor <da...@gmail.com>.
Do we need to check if any documents are marked for deletion?

On 1/12/06, Otis Gospodnetic <ot...@yahoo.com> wrote:
> I don't think we have a public API for that, but the index is considered optimized when it contains only a single segment.
> Then, we could add the following to IndexReader:
>
> public boolean isOptimized() {
>   return segmentInfos.size() == 1;
> }
>
> I think that should do it.
>
> Otis
>
>
> ----- Original Message ----
> From: Maxim Patramanskij <ma...@osua.de>
> To: lucene-user@jakarta.apache.org
> Sent: Wed 11 Jan 2006 08:26:27 AM EST
> Subject: How to check, whether Index is optimized or not?
>
> Hello dear Lucene users!
>
> Is their an easy way to check, whether index is optimized or not?
>
>
> Best regards,
>  Max
>
>
> ---------------------------------------------------------------------
> 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
>
>


--
Research Assistant
Center for Information Mining and Extraction
School of Computing
National University of Singapore.

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


Re: How to check, whether Index is optimized or not?

Posted by Andrzej Bialecki <ab...@getopt.org>.
Otis Gospodnetic wrote:

>I don't think we have a public API for that, but the index is considered optimized when it contains only a single segment.
>Then, we could add the following to IndexReader:
>
>public boolean isOptimized() {
>  return segmentInfos.size() == 1;
>}
>
>I think that should do it.
>  
>

Actually, I think you rather need the following:

public boolean isOptimized() {
  return segmentInfos.size() == 1 && !hasDeletions();
}


-- 
Best regards,
Andrzej Bialecki     <><
 ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com



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


Re: How to check, whether Index is optimized or not?

Posted by Otis Gospodnetic <ot...@yahoo.com>.
I don't think we have a public API for that, but the index is considered optimized when it contains only a single segment.
Then, we could add the following to IndexReader:

public boolean isOptimized() {
  return segmentInfos.size() == 1;
}

I think that should do it.

Otis


----- Original Message ----
From: Maxim Patramanskij <ma...@osua.de>
To: lucene-user@jakarta.apache.org
Sent: Wed 11 Jan 2006 08:26:27 AM EST
Subject: How to check, whether Index is optimized or not?

Hello dear Lucene users!

Is their an easy way to check, whether index is optimized or not?


Best regards,
 Max


---------------------------------------------------------------------
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