[ 
https://issues.apache.org/jira/browse/SOLR-1952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985488#action_12985488
 ] 

Robert Muir commented on SOLR-1952:
-----------------------------------

Perhaps related to SOLR-2108 ?

Unfortunately, that one is only fixable in trunk... it uses the automaton stuff 
to fix the bug.

> Bug when searching leading wildcard query
> -----------------------------------------
>
>                 Key: SOLR-1952
>                 URL: https://issues.apache.org/jira/browse/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:
> {code}
> <add>
>   <doc>
>     <field name="id">1</field>
>     <field name="cat">ab</field>
>   </doc>
>   <doc>
>     <field name="id">2</field>
>     <field name="cat">cb</field>
>   </doc>
>   <doc>
>     <field name="id">3</field>
>     <field name="cat">cbd</field>
>   </doc>
> </add>
> {code}
> then query with leading wildcard:
> http://localhost:8983/solr/select/?q=cat%3A*b
> 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:
> {code}
> public class TestWildcardQuery {
>   static final String INDEX = "solr/example/solr/data/index";
>   
>   public static void main(String[] args) throws Exception {
>     Directory dir = NIOFSDirectory.open( 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 = searcher.search( query, 10 );
>     for( ScoreDoc scoreDoc : docs.scoreDocs ){
>       System.out.println( searcher.doc( scoreDoc.doc ).get( "cat" ) );
>     }
>     searcher.close();
>   }
> }
> {code}

-- 
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: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to