lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Koji Sekiguchi (JIRA)" <j...@apache.org>
Subject [jira] Updated: (LUCENE-1398) Add ReverseStringFilter
Date Mon, 22 Sep 2008 06:35:44 GMT

     [ https://issues.apache.org/jira/browse/LUCENE-1398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Koji Sekiguchi updated LUCENE-1398:
-----------------------------------

    Attachment: LUCENE-1398.patch

Patch attached. The patch includes a new constructor of PrefixQuery:

{code:java}
public PrefixQuery(Term prefix, boolean reverse) {
  if(reverse){
    String s = prefix.text();
    int len = s.length();
    if( len <= 1 ){
      this.prefix = prefix;
      return;
    }
    StringBuffer sb = new StringBuffer(len);
    for( int i = 0; i < len; i++ ){
      sb.append( s.charAt( len - i - 1 ) );
    }
    this.prefix = new Term(prefix.field(),sb.toString());
  }
  else
    this.prefix = prefix;
  }
{code}

so that you can extend PrefixQuery to have SuffixQuery:

{code:java}
class SuffixQuery extends PrefixQuery {
  public SuffixQuery( Term term ){
    super( term, true );
  }
}
{code}


> Add ReverseStringFilter
> -----------------------
>
>                 Key: LUCENE-1398
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1398
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Analysis
>            Reporter: Koji Sekiguchi
>            Priority: Trivial
>         Attachments: LUCENE-1398.patch
>
>
> add ReverseStringFilter and ReverseStringAnalyzer that can be used for backword much.
For Example, "*ry", "*ing", "*ber".

-- 
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


Mime
View raw message