It's probably an issue with analysis and colons and hyphens and dots, maybe lower/upper case as well.
Are you using an analyzer? Which? If not, which might be consistent with your usage of TermQuery, how are you storing the multiple values for alt_id? See also the FAQ entry "Why am I getting no hits / incorrect hits?" http://wiki.apache.org/lucene-java/LuceneFAQ#Why_am_I_getting_no_hits_.2BAC8_incorrect_hits.3F By the way, version 3.0 is ancient. -- Ian. On Mon, Jun 25, 2012 at 1:50 PM, <seceval...@gmail.com> wrote: > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org