Lucene always uses a field, a query using a term without a field is impossible. See each field as a parallel inverted index; all statistics are per field, too. If you pass a query without a field name to QueryParser it will chose the default field, thats given when creating the QueryParser.
Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: sol myr [mailto:solmy...@yahoo.com] > Sent: Tuesday, October 04, 2011 11:46 AM > To: lucene > Subject: [Lucene] Frequencies and positions - are they stored per field? > > > > Hi, > > I use Lucene, but an not familiar with its internals. > I'd appreciate help understanding whether Term Frequences and Positions - are > stored per Document of per Field? > On the one hand, I never ask for "Field.TermVector" because I read it's only > required for "MoreLikeThis" (which I don't need). > On the other hand, my searches *are* based on fields... > > Here's my code: > // Write (without Field.TermVector): > > Document doc=new Document(); > doc.add(new Field("subject", "Requisition request", Store.YES, > Index.ANALYZED)); doc.add(new Field("body", "Attached is an Urgent > requisition request", Store.YES, Index.ANALYZED)); write.addDocument(doc); > > // And my Query: > Query query=parser.parse("subject : urgent"); > > Now how does Lucene manage this query? > I asked it to search the "subject" Field. > But if the "inverted index" doesn't keep fields, it would only remember that > "The term 'Urgent' appears in SOME FIELD of document#1 "... > Isn't it true? > > If so, how would it make sure to retrieve only documents that match in the > Subject ? > > Thanks. > > > --------------------------------------------------------------------- > 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