Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 15073 invoked from network); 11 Nov 2005 18:40:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Nov 2005 18:40:42 -0000 Received: (qmail 95913 invoked by uid 500); 11 Nov 2005 18:40:37 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 95888 invoked by uid 500); 11 Nov 2005 18:40:37 -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 95871 invoked by uid 99); 11 Nov 2005 18:40:37 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Nov 2005 10:40:36 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [24.232.0.217] (HELO avas-mr04.fibertel.com.ar) (24.232.0.217) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Nov 2005 10:40:28 -0800 Received: from OL45-27.fibertel.com.ar ([24.232.27.45]:5130 "EHLO [24.232.27.45]" smtp-auth: "edesantis") by avas-mr04.fibertel.com.ar with ESMTP id S81987AbVKKSkB; Fri, 11 Nov 2005 15:40:01 -0300 X-Comment: RFC 2476 MSA function at avas-mr04.fibertel.com.ar logged sender identity as: edesantis Received: from 127.0.0.1 (AVG SMTP 7.1.362 [267.12.8/166]); Fri, 11 Nov 2005 15:42:02 -0300 Message-ID: <4374E5FA.7080205@colaborativa.net> Date: Fri, 11 Nov 2005 15:42:02 -0300 From: Ernesto De Santis Organization: Colaborativa.net User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: es-es, es MIME-Version: 1.0 To: java-user@lucene.apache.org Subject: Re: highlight only one field References: <20051111180425.59037.qmail@web26011.mail.ukl.yahoo.com> In-Reply-To: <20051111180425.59037.qmail@web26011.mail.ukl.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Fib-Al-Info: Al X-Fib-Al-MRId: d9ba0905c2487950c41b9cc20126b89d X-Fib-Al-From: ernesto.desantis@colaborativa.net X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Yes, this work. ..... String strQuery = query.toString(); WeightedTerm[] weightedTerm = QueryTermExtractor.getTerms(query); ArrayList bodyQueryTerms = new ArrayList(); for (int i = 0; i < weightedTerm.length; i++) { String term = weightedTerm[i].getTerm(); if (strQuery.indexOf(field + ":" + term) != -1) bodyQueryTerms.add(weightedTerm[i]); } ...... Thanks, Ernesto. mark harwood escribi�: >>>>This don't work, because >>>> >>>> > >Ah, crap. You'll have to drop down another level. >Every line of code in QueryTermsExtractor that calls > terms.add(new WeightedTerm(..)) >would be the place to test the field name then. >For now you could copy QueryTermsExtractor and put an >"if" around these lines which tests the field name for >your choice of field. > >Cheers >Mark > > > > >--- Ernesto De Santis > wrote: > > > >>Hi Mark >> >>This don't work, because >> >> WeightedTerm[] weightedTerm = >>QueryTermExtractor.getTerms(query); >> >>return query terms values , not the fields names. >>example: >>for "body:mark title:highlight" >> >>return [mark, highlight], I can't compare this >>values with "body" field. >> >>Ernesto. >> >>mark harwood escribi�: >> >> >> >>>Ah. You're right. Looks like the current >>> >>> >>highlighter >> >> >>>api doesn't offer you that degree of control. >>> >>>The way to fix it is probably to tweak the list of >>>WeightedTerms you give the highlighter: >>>[psuedo code follows...] >>> >>>terms=QueryTermExtractor.getTerms(query); >>>bodyQueryTerms=new ArrayList(); >>>for all terms >>>{ >>> if terms[i].getField().equals("body") >>> bodyQueryTerms.add(terms[i]); >>>} >>>highlighter=new Highlighter(new >>>QueryScorer(bodyQueryTerms.toarray)) >>>highlighter.getBestFragments(bodyTokenStream, >>>bodyText..... >>>[end psuedo code] >>> >>>Hope this helps >>>Mark >>> >>> >>> >>> >>> >>___________________________________________________________ >> >> >> >>>Yahoo! Model Search 2005 - Find the next catwalk >>> >>> >>superstars - >>http://uk.news.yahoo.com/hot/model-search/ >> >> >>--------------------------------------------------------------------- >> >> >>>To unsubscribe, e-mail: >>> >>> >>java-user-unsubscribe@lucene.apache.org >> >> >>>For additional commands, e-mail: >>> >>> >>java-user-help@lucene.apache.org >> >> >>> >>> >>> >>> >>-- >>Ernesto De Santis - Colaborativa.net >>La Plata, Argentina. >>http://www.colaborativa.net/ >> >> >> >> >> >--------------------------------------------------------------------- > > >>To unsubscribe, e-mail: >>java-user-unsubscribe@lucene.apache.org >>For additional commands, e-mail: >>java-user-help@lucene.apache.org >> >> >> >> > > > > >___________________________________________________________ >To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com > >--------------------------------------------------------------------- >To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org >For additional commands, e-mail: java-user-help@lucene.apache.org > > > > -- Ernesto De Santis - Colaborativa.net La Plata, Argentina. http://www.colaborativa.net/ --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org