Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF791DCCD for ; Mon, 22 Oct 2012 14:04:43 +0000 (UTC) Received: (qmail 46667 invoked by uid 500); 22 Oct 2012 14:04:41 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 46611 invoked by uid 500); 22 Oct 2012 14:04:41 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 46577 invoked by uid 99); 22 Oct 2012 14:04:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Oct 2012 14:04:40 +0000 X-ASF-Spam-Status: No, hits=1.3 required=5.0 tests=SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [89.161.223.23] (HELO v044473.home.net.pl) (89.161.223.23) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 22 Oct 2012 14:04:33 +0000 Received: from 078088007253.bialystok.vectranet.pl [78.88.7.253] (HELO localhost) by alud.home.pl [89.161.223.23] with SMTP (IdeaSmtpServer v0.80) id cfbfa4a5e6ec375a; Mon, 22 Oct 2012 16:04:12 +0200 Date: Mon, 22 Oct 2012 16:04:11 +0200 From: =?utf-8?Q?Rafa=C5=82_Ku=C4=87?= X-Priority: 3 (Normal) Message-ID: <1961183.20121022160411@alud.com.pl> To: java-user@lucene.apache.org Subject: Re: Restrict Lucene search in concrete document ids In-Reply-To: <1350914290710-4015123.post@n3.nabble.com> References: <1350376607967-4013905.post@n3.nabble.com> <1350485413353-4014258.post@n3.nabble.com> <1350895082501-4015074.post@n3.nabble.com> <1350914290710-4015123.post@n3.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hello! I think you should ask about Lucene.NET on the proper mailing list dedicated to it, instead on the current one which is dedicated to Java version of Lucene. You can find the proper mailing addresses here: http://lucenenet.apache.org= /community.html --=20 Regards, Rafa=C5=82 Ku=C4=87 Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch > I work with Lucene.Net. , version 2.9 > The code is : > Searching: > Filter filter =3D new PictureIdFilter( allowedResources ); > TopDocs docs =3D searcher.Search( boolQuery, filter, documentCount ); > ScoreDoc[] hits =3D docs.scoreDocs; > And the filter is : > class PictureIdFilter : Filter > + { > + ILog log =3D LogManager.GetLogger("PictureIdFilter"); > + private BitArray bits; > + > + private HashSet bag; > + > + public PictureIdFilter(ResourceKey[] allowedResources) > + { > + var sw =3D new Stopwatch(); > + sw.Start(); > + bag =3D new HashSet(allowedResources.Select( x=3D>>x.ResourceId.ToString() )); > + sw.Stop(); > + log.Warn("PictureIdFilter hashset create: " + > sw.ElapsedMilliseconds); > + } > + > + public override BitArray Bits(IndexReader reader) > + { > + var maxDoc =3D reader.MaxDoc(); > + log.Warn("PictureIdFilter maxdoc: " + maxDoc); > + var result =3D new BitArray(maxDoc); > + var sw =3D new Stopwatch(); > + sw.Start(); > + for (int i =3D 0; i < maxDoc; i++) > + { > + var doc =3D reader.Document( i ); > + Field field =3D doc.GetField( "IDPicture" ); > + string fieldValue =3D field.StringValue(); > + if (bag.Contains( fieldValue )) > + { > + result[i] =3D true; > + } > + } > + sw.Stop(); > + log.Warn("PictureIdFilter going over results: " + > sw.ElapsedMilliseconds); > + return result; > + } > + } > The problem with that code is that it takes too much time.. That's why I > tried to filter by DocumentId somehow, but couldn't find the proper ifc. > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Restrict-Lucene-search-in-concrete-doc= ument-ids-tp4013905p4015123.html > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org