You can add the terms with Field.Index.NOT_ANALYZED multiple times to the same field. If you use an analyzer like WhitespaceAnalyzer and you analyze your tersm, you must also pass the analyzed term through analyzer when building a TermQuery. This may explain, why you don’t get those IDs.
But for IDs in general, you should not use analyzers and add as NOT_ANYLYZED and query with TermQuery. As explained before, just add more than one term to the same field. ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Kristjan Siimson [mailto:kristjan.siim...@gmail.com] > Sent: Wednesday, April 14, 2010 9:16 PM > To: java-user@lucene.apache.org > Subject: Indexing lists of IDs > > Hello, > > I have document for which I'd like to index an array of indexes. For > example, there is a product that belongs to categories with IDs 12, 15, > 16, > 145, 148. I'd like to index these categories, and then be able to use > them > in queries, so that I can search for product which's name is "Bottle" > and > which belongs to category 12. > > I came up with creating a field in which I store the ID numbers and > separate > them with spaces. However, when I tried to create a term query, the > query > never gave any results. Can anybody help me with this? > > Sincerely, > Kristjan Siimson --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org