Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 77930 invoked from network); 10 Sep 2009 13:51:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Sep 2009 13:51:21 -0000 Received: (qmail 8559 invoked by uid 500); 10 Sep 2009 13:51:20 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 8466 invoked by uid 500); 10 Sep 2009 13:51:20 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 8457 invoked by uid 99); 10 Sep 2009 13:51:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2009 13:51:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2009 13:51:18 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C164E234C1EF for ; Thu, 10 Sep 2009 06:50:57 -0700 (PDT) Message-ID: <108898927.1252590657791.JavaMail.jira@brutus> Date: Thu, 10 Sep 2009 06:50:57 -0700 (PDT) From: "Robert Muir (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-1370) Patch to make ShingleFilter output a unigram if no ngrams can be generated In-Reply-To: <1433805798.1220050664247.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-1370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753623#action_12753623 ] Robert Muir commented on LUCENE-1370: ------------------------------------- Uwe, I see... i had not looked far enough yet to see how this was done, thanks. but i think my comment still holds true, we can save a clone() here on the first token. for long fields does not matter so much, but for short fields a small savings. > Patch to make ShingleFilter output a unigram if no ngrams can be generated > -------------------------------------------------------------------------- > > Key: LUCENE-1370 > URL: https://issues.apache.org/jira/browse/LUCENE-1370 > Project: Lucene - Java > Issue Type: Improvement > Components: contrib/analyzers > Reporter: Chris Harris > Assignee: Karl Wettin > Attachments: LUCENE-1370.patch, LUCENE-1370.patch, LUCENE-1370.patch, ShingleFilter.patch > > > Currently if ShingleFilter.outputUnigrams==false and the underlying token stream is only one token long, then ShingleFilter.next() won't return any tokens. This patch provides a new option, outputUnigramIfNoNgrams; if this option is set and the underlying stream is only one token long, then ShingleFilter will return that token, regardless of the setting of outputUnigrams. > My use case here is speeding up phrase queries. The technique is as follows: > First, doing index-time analysis using ShingleFilter (using outputUnigrams==true), thereby expanding things as follows: > "please divide this sentence into shingles" -> > "please", "please divide" > "divide", "divide this" > "this", "this sentence" > "sentence", "sentence into" > "into", "into shingles" > "shingles" > Second, do query-time analysis using ShingleFilter (using outputUnigrams==false and outputUnigramIfNoNgrams==true). If the user enters a phrase query, it will get tokenized in the following manner: > "please divide this sentence into shingles" -> > "please divide" > "divide this" > "this sentence" > "sentence into" > "into shingles" > By doing phrase queries with bigrams like this, I can gain a very considerable speedup. Without the outputUnigramIfNoNgrams option, then a single word query would tokenize like this: > "please" -> > [no tokens] > But thanks to outputUnigramIfNoNgrams, single words will now tokenize like this: > "please" -> > "please" > **** > The patch also adds a little to the pre-outputUnigramIfNoNgrams option tests. > **** > I'm not sure if the patch in this state is useful to anyone else, but I thought I should throw it up here and try to find out. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org