java.lang.OutOfMemoryError: Java heap space when sorting the fields

2008-03-18 Thread sandyg
this is my search content QueryParser parser = new QueryParser("keyword",new StandardAnalyzer()); Query query = parser.parse("1"); Sort sort = new Sort(new SortField(sortField)); Hits hits = searcher.search(query,sort); And i had huge data about 13 millions of records i am not

Re: java.lang.OutOfMemoryError: Java heap space when sorting the fields

2008-03-18 Thread Chris Lu
This is because sorting will load all values in that sortFirled into memory. If it's an integer, you will need 4*N bytes, which is additional 52M for you. There is no programatical way to increase memory size. -- Chris Lu - Instant Scalable Full-Text Search On Any Databa

Re: java.lang.OutOfMemoryError: Java heap space when sorting the fields

2008-03-18 Thread Mark Miller
To sort on 13mil docs will take like at least 400 mb for the field cache. Thats if you only sort on one field...it can grow fast if you allow multi field sorting. How much RAM are you giving your app? sandyg wrote: this is my search content QueryParser parser = new QueryParser("keyword",new

Re: java.lang.OutOfMemoryError: Java heap space when sorting the fields

2008-03-18 Thread Mark Miller
Whoops...10 times to much there. more like 40 meg I think. A string sort could be a bit higher though, you also need to store all of terms to index into. sandyg wrote: this is my search content QueryParser parser = new QueryParser("keyword",new StandardAnalyzer()); Query query = parser.parse

Re: java.lang.OutOfMemoryError: Java heap space when sorting the fields

2008-03-18 Thread sandyg
Thanks for the reply. Actually am sorting on a specific field that is on keyword feild which is unique and i had 1 gb ram markrmiller wrote: > > To sort on 13mil docs will take like at least 400 mb for the field > cache. Thats if you only sort on one field...it can grow fast if you > allow mu

Re: java.lang.OutOfMemoryError: Java heap space when sorting the fields

2008-03-18 Thread sandyg
How can i do sorting on the results i get (if already hits are there then how to sort on the hits),instead of sorting on all the values b4 getting results Chris Lu wrote: > > This is because sorting will load all values in that sortFirled into > memory. > > If it's an integer, you will need 4*

Re: java.lang.OutOfMemoryError: Java heap space when sorting the fields

2008-03-19 Thread sandyg
Hi, And is it not passibe to sort on the result we get instead of on all the values like Hits hits = searcher.search(query); and it will be good if got sorting on the hits i.e on the result thanks for the reply markrmiller wrote: > > To sort on 13mil docs will take like at least 400 mb fo

Re: java.lang.OutOfMemoryError: Java heap space when sorting the fields

2008-03-19 Thread Mark Miller
Heres what happens: in order to sort all of the hits you get back on a field, you need to get the value of that field for comparisons right? Well it turns out that reading a field value from the index is pretty slow (its on the disk after all)...so Lucene will read all of the terms in the field

Re: java.lang.OutOfMemoryError: Java heap space when sorting the fields

2008-03-19 Thread Daniel Noll
On Thursday 20 March 2008 07:22:27 Mark Miller wrote: > You might think, if I only ask for the top 10 docs, don't i only read 10 > field values? But of course you don't know what docs will be returned as > each search comes in...so you have to cache them all. If it lazily cached one field at a tim

Re: java.lang.OutOfMemoryError: Java heap space when sorting the fields

2008-03-19 Thread Chris Hostetter
: You might think, if I only ask for the top 10 docs, don't i only read 10 field : values? But of course you don't know what docs will be returned as each search : comes in...so you have to cache them all. Arguements have been made in the past that when you have an index large enough that the Fi