Return-Path: Delivered-To: apmail-incubator-lucene-net-user-archive@minotaur.apache.org Received: (qmail 1229 invoked from network); 23 Oct 2009 16:04:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Oct 2009 16:04:44 -0000 Received: (qmail 28501 invoked by uid 500); 23 Oct 2009 16:04:44 -0000 Delivered-To: apmail-incubator-lucene-net-user-archive@incubator.apache.org Received: (qmail 28486 invoked by uid 500); 23 Oct 2009 16:04:43 -0000 Mailing-List: contact lucene-net-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-user@incubator.apache.org Delivered-To: mailing list lucene-net-user@incubator.apache.org Received: (qmail 28476 invoked by uid 99); 23 Oct 2009 16:04:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Oct 2009 16:04:43 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of Eric.Advincula@co.mohave.az.us designates 199.104.207.4 as permitted sender) Received: from [199.104.207.4] (HELO grpwise.co.mohave.az.us) (199.104.207.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Oct 2009 16:04:41 +0000 Received: from Mohave-MTA by grpwise.co.mohave.az.us with Novell_GroupWise; Fri, 23 Oct 2009 09:04:27 -0700 Message-Id: <4AE17170.9E65.0028.0@co.mohave.az.us> X-Mailer: Novell GroupWise Internet Agent 7.0.2 HP Date: Fri, 23 Oct 2009 09:03:44 -0700 From: "Eric Advincula" To: Subject: RE: How to loop through all the entries for a field References: <4AE01D10.9E65.0028.0@co.mohave.az.us> <002d01ca534b$9d450800$d7cf1800$@com> <4AE06A3A.9E65.0028.0@co.mohave.az.us> <4AE06BD3.9E65.0028.0@co.mohave.az.us> <4AE09256.9E65.0028.0@co.mohave.az.us> <5937015f0910230205i54a3ff2cyff6a4a57284fe66c@mail.gmail.com> <4AE14CCD.9E65.0028.0@co.mohave.az.us> <000001ca53f8$e84c9bd0$b8e5d370$@com> In-Reply-To: <000001ca53f8$e84c9bd0$b8e5d370$@com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__PartE0CB46F0.0__=" --=__PartE0CB46F0.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable That worked great. =20 Thanks >>>=20 From: "Digy" To: Date: 10/23/2009 8:54 AM Subject: RE: How to loop through all the entries for a field while( (term =3D tEnum.Term())!=3Dnull ) { .... Lucene.Net.Index.TermDocs tDocs =3D reader.TermDocs(term);= tDocs.Next(); string otherValue =3D reader.Document(tDocs.Doc()).GetField("PageCount").StringValue(); tEnum.Next(); }; but ,as i said (asked) before, what would you do if two books have the = same title with different # of pages? DIGY. -----Original Message----- From: Eric Advincula [mailto:Eric.Advincula@co.mohave.az.us]=20 Sent: Friday, October 23, 2009 4:27 PM To: lucene-net-user@incubator.apache.org=20 Subject: Re: How to loop through all the entries for a field This is what I have: reader =3D IndexReader.Open(Commons.Constants._FSDirectory)= ; termEnum =3D reader.Terms(new Term("BookTitle", "")); while ((term =3D termEnum.Term()) !=3D null) { if (!term.Field().Equals("Title")) break; if (term.Text() =3D=3D title) { termDocs =3D reader.TermDocs(term); =20 result =3D true; break; } termEnum.Next(); } But i'm not sure what to do with termDocs to get the information contained in PageCount. The pages vary from book to book. Thanks >>>=20 From: digy digy To: Date: 10/23/2009 2:06 AM Subject: Re: How to loop through all the entries for a field You can use "Lucene.Net.Index.TermDocs tDocs =3D reader.TermDocs(term)" = in your loop. DIGY PS: Another Question: How many pages does the book "T1" have? Title : T1 Author : A1 #ofPages : 100 Publisher: P1 Title : T1 Author : A2 #ofPages : 200 Publisher: P1 Title : T1 Author : A1 #ofPages : 102 Publisher: P2 On Fri, Oct 23, 2009 at 3:11 AM, Eric Advincula < Eric.Advincula@co.mohave.az.us> wrote: > Question, now that i'm looping through the BookTitle, how can i also get > the PageCount field that is part of the document. So every BookTitle = has a > PageCount to signify the total number of pages per book. > Thanks > > > > reader =3D IndexReader.Open(Commons.Constants._FSDirectory= ); > termEnum =3D reader.Terms(new Term("BookTitle", "")); > > > while ((term =3D termEnum.Term()) !=3D null) > { > if (!term.Field().Equals("BookTitle")) > break; > > map =3D new SearchResultMap(); > map.Title =3D term.Text(); > > control.Items.Add(map); > > termEnum.Next(); > } > > > >>> > > From: "Eric Advincula" > To: > Date: 10/22/2009 2:29 PM > Subject: RE: How to loop through all the entries for a field > nevermind I figured it out. I did this: > > while ((term =3D termEnum.Term()) !=3D null) > { > if (!term.Field().Equals("BookTitle")) > break; > > map =3D new SearchResultMap(); > map.Title =3D term.Text(); > > control.Items.Add(map); > > termEnum.Next(); > } > > thanks for all the help > > > >>> > > From: "Eric Advincula" > To: > Date: 10/22/2009 2:22 PM > Subject: RE: How to loop through all the entries for a field > It works but continues even after the listing. > How do you know if your on your last term? I tried it and it does work but > continues. How do you know to check if its the last entry? > > Thanks > > >>> > > From: "Digy" > To: > Date: 10/22/2009 12:13 PM > Subject: RE: How to loop through all the entries for a field > Something like that? > > > > Lucene.Net.Index.IndexReader reader =3D > Lucene.Net.Index.IndexReader.Open(dir); > > Lucene.Net.Index.TermEnum tEnum =3D reader.Terms(new > Lucene.Net.Index.Term("BookTitle")); > > do > > { > > Lucene.Net.Index.Term t =3D tEnum.Term(); > > Console.WriteLine(t.Text()); > > } while (tEnum.Next()); > > > > DIGY > > > > -----Original Message----- > From: Eric Advincula [mailto:Eric.Advincula@co.mohave.az.us]=20 > Sent: Thursday, October 22, 2009 6:51 PM > To: lucene-net-user@incubator.apache.org=20 > Subject: How to loop through all the entries for a field > > > > I have a field in called BookTitle. I want to loop through all the entries > without doing a search. I just want to get the list of BookTitle's that is > in this field: > > > > I tried IndexReader but MaxDocs() doesnt work because it returns everything > and I have other fields in their which is allot bigger. > > > > Thanks > > > > > > > > > > > >=20 > !DSPAM:4ae1d08d837949230893912! --=__PartE0CB46F0.0__=--