Leonard, Make sure the "key" or "id" fields are not analyzed and that should solve your problems. You are using some older version of Lucene?
Otis -- Sematext is hiring -- http://sematext.com/about/jobs.html?mls Lucene, Solr, Nutch, Katta, Hadoop, HBase, UIMA, NLP, NER, IR ----- Original Message ---- > From: Leonard Gestrin <leonard.gest...@markettools.com> > To: "java-user@lucene.apache.org" <java-user@lucene.apache.org> > Sent: Sunday, August 2, 2009 10:49:27 PM > Subject: question about indexing/searching using standardanalyzer for KEYWORD > field that contains alphanumeric data > > > Hello, > I have question about KEYWORD type and searching/updating. I am getting > strange > behavior that I can't quite comprehend. > My index is created using standard analyzer, which used for writing and > searching. It has three fields > > userpin - alphanumeric field which is stored as TEXT > documentkey - alphanumeric field which is stored as TEXT > contents - text of document which is stored as TEXT > > When I try to update document I am creating Term to find document by > documentKey > and I am using > > org.apache.lucene.index.IndexWriter.updateDocument(term, pDocument); > > to do the update. Lucene fails to find the document by the term and I am > getting duplicate documents in the index. > When I changed index to define documentKey as KEYWORD the updates started to > work fine. > However, search for documentKey using StandardAnalyzer stopped working. > > It appears that lucene is using keywordAnalyzer for searching for the term > during update, even though the indexer is open with StandardAnalyzer. > > The sample values that are stored in documentKeys are: "L2222FAHBHMF", > "L2222FAHBHAS". > I noticed if documentKey is numeric value, both KeywordAnalyzer and > StandardAnalyzer can find the documents by it without any problem thus reader > can find and indexer can update without any problems. With alphanumeric I > cant > get both to work. > Any help is appreciated. > Thanks > Leonard > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org