You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Koji Sekiguchi (JIRA)" <ji...@apache.org> on 2011/01/24 03:38:44 UTC
[jira] Updated: (SOLR-1952) Bug when searching leading wildcard
query
[ https://issues.apache.org/jira/browse/SOLR-1952?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Koji Sekiguchi updated SOLR-1952:
---------------------------------
Fix Version/s: (was: 3.1)
4.0
Duplicate of SOLR-2108
> 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: 4.0
>
>
> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org