[prev in list] [next in list] [prev in thread] [next in thread]
List: lucene-user
Subject: Lucene "cuts" the search results ?
From: Pierre VANNIER <thinapps () gmail ! com>
Date: 2005-02-15 8:39:48
Message-ID: 4211B554.2080903 () gmail ! com
[Download RAW message or body]
Hi all,
I'm quite a newbie for Lucene, but I bought "Lucene In Action" and I'm
trying to customize few examples caught from there.
I Have this sample code of JSP (bad JSP caus' I'm also a jsp newbie - :-)) :
Here's the code
------------------------------------------------------------------------------------------------
.....html head body ....
<%
long start = new Date().getTime();
Iterator myIterator = vIndexDir.iterator();
while(myIterator.hasNext())
{
IndexSearcher searcher = new IndexSearcher((String)myIterator.next());
Query query = new TermQuery(new Term("introduction", queryString));
Hits hits = searcher.search(query);
QueryScorer scorer = new QueryScorer(query);
Highlighter highlighter = new Highlighter(scorer);
%>
<table width="70%" cellpadding="2" cellspacing="2">
<%
out.println("<tr><td><hr><br/>NUMBER OF MATCHING NEWS FOR \""+
(String)myIterator.next() + "\" -->" +hits.length() + " </td></tr>");
for (int i = 0; i < hits.length(); i++)
{
String introduction = hits.doc(i).get("introduction");
TokenStream stream = new
SimpleAnalyzer().tokenStream("introduction", new
StringReader(introduction));
String fragment = highlighter.getBestFragment(stream,
introduction);
String pubDate = hits.doc(i).get("pubDate").substring(0,
hits.doc(i).get("pubDate").length()-13);
String link = hits.doc(i).get("link");
float score = hits.score(i);
String title = hits.doc(i).get("title");
%>
<tr>
<td>
Scoring : <b><%=score%></b><br/>
<%=pubDate +
" <a href=\"#\" onClick=\"window.open('" +
link + "', 'news', 'width=760;height=600')\">" +
title +
"</a>"
%>
<br/>
<%= fragment%>
<br/><br/>
</td>
</tr>
<%}%>
</table>
<%
}
long end = new Date().getTime();
long interval = end - start;
%>
<br><br><div align="right"><b>System time for query : <%= interval%>
milliseconds</b></div>
</body>
</html>
-------------------------------------------------------------------------------
The output is all right, but at the en of this result page, the last
"hit" is cut (I mean for example) :
Scoring : 0.9210043
Fri, 28 Jan 2005
---------------------------------------------
I'm running all this in tomcat 5.0.28 and last nightly fresh build of
lucene.
So, Could it be a caching problem ? Could this come from JSP or Lucene ?
Thanks, and please I do apologise for my poor english ;-)
Pierre VANNIER
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic