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: [email protected]
For additional commands, e-mail: [email protected]