I have a program that uses Lucene.net in ASP.NET (VB.NET), when you search a term, results are stored in the Lucene.net data structure "hits".
I want to read out the hits into an data structure and work with them, after that I display them in 开发者_开发百科a DataGrid
.
By searching a term with a lot of results, often (but not always) there is an error by following code :
For i = 0 To results - 1 Step 1
Try
Dim tmpobj As New object_hit(( _
hits.Doc(i).Get("title") + _
hits.Doc(i).Get("doc_typ")), _
hits.Doc(i).Get("pfad"), _
hits.Doc(i).Get("last_change"), _
hits.Doc(i).Get("doc_typ"), _
CStr(hits.Score(i)))
list_of_results.Add(tmpobj) 'works'
Catch
meldung.Text = "Stackoverflow- zuviele Ergebnisse "
myexception = True
End Try
I checked the server; it's a dwh server and has no problems to execute the program.
At first I used a ReDim Array
, but now I use a List(Of T)
. I heard that should solve the problem, but it doesn't - now I'm very confused and don't know what to do-
can someone help me please?
Change the Catch
block so that you actually can see what is happening here:
Catch ex as Exception
meldung.Text = ex.Message ' or ex.ToString() to see full details '
throw
End Try
You are probably not getting a StackOverflowException
here.
my browser crashed, so i have to write as an guest : < sorry.
i tried that:
Exception of type 'System.OutOfMemoryException' was thrown.
now i have an correct for loop, with only one line of code in it
list_of_results.Add(New object_hit((hits.Doc(i).Get("title") + hits.Doc(i).Get("doc_typ")), hits.Doc(i).Get("pfad"), hits.Doc(i).Get("last_change"), hits.Doc(i).Get("doc_typ"), CStr(hits.Score(i))))
so what happened? (the server is an dwh server, it should make it ...)
thanks
精彩评论