lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastin <sebasmt...@gmail.com>
Subject Re: Java Heap Space -Out Of Memory Error
Date Thu, 06 Sep 2007 06:01:09 GMT

i wont close the IndexReader after the First Search.when i instantiate
IndexSearcher object will it display the updated records in that directories

Sebastin wrote:
> 
> I set IndexSearcher as the application Object after the first search.
> 
> here is my code:
> 
>                              if(searcherOne.isOpen()==(true)){       
>      
>                                          Directory compressDir2 = 
>                      
> FSDirectory.getDirectory(compressionSourceDir02,false);
>                                          IndexReader compressedSource2 =
> IndexReader.open(compressDir2);
>                                        Directory compressDir3 = 
>                                             
> FSDirectory.getDirectory(compressionSourceDir03,false);
>                                          IndexReader compressedSource3 =
> IndexReader.open(compressDir3);
>                                          Directory compressDir4 = 
>                                             
> FSDirectory.getDirectory(compressionSourceDir04,false);
>                                          IndexReader compressedSource4 =
> IndexReader.open(compressDir4); 
>                                         
>           
>                                          
>         IndexReader[] readArray =
> {compressedSource2,compressedSource3,compressedSource4};
>         //merged reader
>         IndexReader mergedReader = new MultiReader(readArray);
>         IndexSearcher is = new IndexSearcher(mergedReader);
>                                 
> BooleanQuery.setMaxClauseCount(1000000000);
>         searcherOne.setIndexSearch(is);
>                                          searcherOne.setOpen(false);
>                                  BigInteger _l = new BigInteger(mobile1,
> 10);
>                                  _mobile = _l.toString(36);
>                                  QueryParser parser = 
>                                      new
> QueryParser(AppConstants.CONTENTS, new StandardAnalyzer());
>                                  
>                                  
>                                 searchQuery= 
>                                        new
> StringBuffer().append(_mobile).append(" AND dateSc:["
> ).append(fromDate).append(" TO ").append(toDate).append("]").append("
> ").append("AND").append(" ").append(callTyp).toString();
>                                     
>                                  
>                                  
>                                  
>                                  Query callDetailquery =
> parser.parse(searchQuery);
>                                  
>                                  hits = is.search(callDetailquery);
>                                  System.out.println("FirstSearch");
>                                  
>                                  
>                              }
>       // System.out.println("No Of MAXIMUM dOCUMENTS : " +is.maxDoc());
>       else{
>           
>        is=searcherOne.getIndexSearch();
>       
>         BigInteger _l = new BigInteger(mobile1, 10);
>         _mobile = _l.toString(36);
>    
>         BooleanQuery.setMaxClauseCount(1000000000);
>         QueryParser parser = 
>             new QueryParser(AppConstants.CONTENTS, new
> StandardAnalyzer());
>         
>           searchQuery=new StringBuffer().append(_mobile).append("
> ").append(" AND dateSc:[" ).append(fromDate).append(" TO
> ").append(toDate).append("]").append(" ").append("AND").append("
> ").append(callTyp).toString(); 
>          
>               
>            
>        
>         
>         
>          callDetailquery = parser.parse(searchQuery);
>         
>       hits = is.search(callDetailquery);
>              
> 
> how can i reconstruct the new IndexSearcher for every hour to see the
> updated records .
>                                      
> 
> 
> hossman wrote:
>> 
>> 
>> : I use StandardAnalyzer.the records daily ranges from 5 crore to 6
>> crore. for
>> : every second i am updating my Index. i instantiate IndexSearcher object
>> one
>> : time for all the searches. for an hour can i see the updated records in
>> the
>> : indexstore by reinstantiating IndexSearcher object.but the problem when
>> i
>> : reinstantiate IndexSearcher ,my RAM memory gets appended.is there any
>> 
>> skimming hte code below, you are opening an IndexSearcher over a 
>> MultiReader over 4 seperate IndexReaders ... when you instantiate a new 
>> IndexSearcher are you explicitly closing both the old IndexSearcher as 
>> well as all of 4 of those old IndexReaders and the MultiReader?
>> 
>> closing an IndexSearcher will only close the underlying Reader if it 
>> opened it .. and a MultiReader constructed from other IndexReaders will 
>> never close them.
>> 
>> -Hoss
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Java-Heap-Space--Out-Of-Memory-Error-tf4376803.html#a12516112
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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