I'm quite new to Lucene and recently, I ran into a problem. I have a lucene document that looks like this:
--- type --- gene --- id --- xla:379474 --- alt_id --- emb:BC054227 gb:BC054227 ncbi-geneid:379474 ncbi-gi:148230166 rs:NM_001086315 rs:NP_001079784 unigene:Xl.24622 xla:379474 I created the query bellow in order to retrieve that document. It works fine for altId = 379474 but not for altId = ncbi-geneid:379474 or Xl.24622. I guessed altId must be escaped and tried String altId = QueryParser.escape(altId) with no luck. What I'm I missing? Query query1 = new TermQuery(new Term("type", "gene")); Query query2 = new TermQuery(new Term("alt_Id", altId)); BooleanQuery query = new BooleanQuery(); query.add(query1, BooleanClause.Occur.MUST); query.add(query2, BooleanClause.Occur.MUST); By the way I'm running lucene v3.0. Cheers, José M. Villaveces