lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Schlegel (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-838) WildcardQuery do not find documents
Date Wed, 21 Mar 2007 08:21:32 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-838?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12482670
] 

Michael Schlegel commented on LUCENE-838:
-----------------------------------------

Hi !

Sorry, but it was my first bug request.
You resolved the bug because you can not reproduce.

Here is the a simple example code, which demonstrate the problem:

public class WildcardTest
{
    
    public static void main(String[] args) throws Exception
    {
        Analyzer analyzer = new GermanAnalyzer();
        
        RAMDirectory indexStore = getIndexStore("fulltext", new String[]{"Forschungsgebiet",
"business"}, analyzer);
        
        IndexSearcher searcher = new IndexSearcher(indexStore);
        
        QueryParser parser = new QueryParser( "fulltext", analyzer );
        Query query1 = parser.parse("fulltext:Forschungsgebie*");
        Query query2 = parser.parse("fulltext:Forschungsgebiet*");
        
        
        Hits result = searcher.search(query1);
        System.out.println( query1.toString() );
        System.out.println( "Query '" + query1.toString() + "' found: " + result.length()
+ " documents !");

        result = searcher.search(query2);
        System.out.println( query2.toString() );
        System.out.println( "Query '" + query2.toString() + "' found: " + result.length()
+ " documents !");

        
        searcher.close();
        indexStore.close();
    }
    
    private static RAMDirectory getIndexStore(String field, String[] contents, Analyzer p_Analyzer)
    throws IOException
    {
        RAMDirectory indexStore = new RAMDirectory();
        IndexWriter writer = new IndexWriter(indexStore, p_Analyzer, true);
        for (int i = 0; i < contents.length; ++i)
        {
            Document doc = new Document();
            doc.add(new Field(field, contents[i], Field.Store.YES, Field.Index.TOKENIZED));
            writer.addDocument(doc);
        }
        writer.optimize();
        writer.close();
        
        return indexStore;
    }
}

Output:
Query 'fulltext:forschungsgebie*' found: 1 documents !
Query 'fulltext:forschungsgebiet*' found: 0 documents !




----- Ursprüngliche Mail ----
Von: Hoss Man (JIRA) <jira@apache.org>
An: lulog1@yahoo.de
Gesendet: Dienstag, den 20. März 2007, 19:07:32 Uhr
Betreff: [jira] Resolved: (LUCENE-838) WildcardQuery do not find documents


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

Hoss Man resolved LUCENE-838.
-----------------------------

    Resolution: Cannot Reproduce


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.








		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de


> WildcardQuery do not find documents
> -----------------------------------
>
>                 Key: LUCENE-838
>                 URL: https://issues.apache.org/jira/browse/LUCENE-838
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>    Affects Versions: 1.9, 2.0.0, 2.1
>         Environment: Windows XP; JDK 1.5
>            Reporter: Michael Schlegel
>
> Example:
> I index a document by using GermanAnalyzer.
> This document contains following word "Forschungsgebiet".
> This word will be analyzed and transformed to "Forschungsgebie".
> If i use query "Forschungsgebiet" to search the document, i will find the document.
> If i use query "Forschungsgebie*" or "Forschung*" i will find the document too.
> But if i use query "Forschungsgebiet*" or "?orschungsgebiet" i never will find this document.
> It looks so that the query will not be analyzed by the given Analyzer and thatswhy i
will not find the document    (Forschungsgebiet != Forschungsgebie).
> The same can happen if a other analyzer is used.

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