I'm using this for searching (extracted and not full code):
IndexSearcher indexSearcher = new IndexSearcher("index");
final QueryParser queryParser = new QueryParser("Line", myAnalyzer);
queryParser.setAllowLeadingWildcard(true);
final Query query = queryParser.parse(searchText);
final BitSet bits = new BitSet(indexSearcher.maxDoc());
indexSearcher.search(query, new HitCollector(){public void collect(int doc,
float score){bits.set(doc);}});
for(int j=0; j<bits.length() ; j++)
{
if(bits.get(j))
{
final Document doc = indexSearcher.doc(j);
searchResults.addElement(doc.get("name"));
}
}
---------
for indexing:
final IndexWriter indexWriter = new IndexWriter("index", myAnalyzer, true,
new IndexWriter.MaxFieldLength(1500));
while(rs.next())
{
final Document doc = new Document();
doc.add(new Field("name", rs.getString("name"), Field.Store.YES,
Field.Index.NOT_ANALYZED));
doc.add(new Field("Line" , rs.getString("Line"), Field.Store.YES,
Field.Index.ANALYZED));
indexWriter.addDocument(doc);
}
----------
it happens only sometimes.
thanks
Erick Erickson wrote:
>
> You need to provide more context for your question, as
> it is it's unanswerable.
>
> What are you doing when you get this message? What are
> you trying to do? What is your setup? Code fragments
> would be useful for both your indexing and searching.
>
--
View this message in context:
http://www.nabble.com/Strange-output-tp21927297p22032888.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]