lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Koji Sekiguchi (JIRA)" <>
Subject [jira] Created: (SOLR-1952) Bug when searching leading wildcard query
Date Tue, 15 Jun 2010 03:25:23 GMT
Bug when searching leading wildcard query

                 Key: SOLR-1952
             Project: Solr
          Issue Type: Bug
    Affects Versions: 3.1
            Reporter: Koji Sekiguchi
            Priority: Minor
             Fix For: 3.1

Post/commit the following data for solr example:

    <field name="id">1</field>
    <field name="cat">ab</field>
    <field name="id">2</field>
    <field name="cat">cb</field>
    <field name="id">3</field>
    <field name="cat">cbd</field>

then query with leading wildcard:


but no results. This works in 1.4. I wrote the following lucene (using branch_3x) program
which queries the same index and got two docs correctly:

public class TestWildcardQuery {

  static final String INDEX = "solr/example/solr/data/index";
  public static void main(String[] args) throws Exception {
    Directory dir = new File( INDEX ) );
    IndexSearcher searcher = new IndexSearcher( dir, true );
    QueryParser parser = new QueryParser( Version.LUCENE_31, "cat", new WhitespaceAnalyzer(
Version.LUCENE_31 ) );
    parser.setAllowLeadingWildcard( true );
    //Query query = parser.parse( "*b" );
    Query query = new WildcardQuery( new Term( "cat", "*b" ) );
    TopDocs docs = query, 10 );
    for( ScoreDoc scoreDoc : docs.scoreDocs ){
      System.out.println( searcher.doc( scoreDoc.doc ).get( "cat" ) );


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:
For additional commands, e-mail:

View raw message