You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2009/07/01 00:49:26 UTC

Re: Identification of matching by field

: Date: Fri, 12 Jun 2009 10:17:14 -0300
: From: hpn1975 nasc
: Subject: Identification of matching by field

This question doesn't seem to have anything to do with Solr.  I would 
suggest you ask it on the java-users@lucene mailing list.

: 
: Hi,
: 
:   Is possible to identify docId of document where occurred matching in
: specific Term or QueryTerm ?
: 
:    For example: I have a document with some fields and my query possesss the
: Query for each field. I need to know the docIds when the QueryTermX finds
: value. I know that I can verify if matching in the method below, but I think
: that not will performatic.
: 
: Searcher searcher = new IndexSearcher(indexReader);
:    final BitSet bits = new BitSet(indexReader.maxDoc());
:    searcher.search(query, new HitCollector() {
:        public void collect(int doc, float score) {
: *           if (reader.doc(doc).getField("Name").equals(search_word)){*
: *              bits.set(doc);*
: *           }
: *       }
:      });
:   Thanks
: 



-Hoss