> I am indexing as text field. Search for 05qzFebqz01, 05q* do not work. I am
> using a StandardAnalyzer. Search for 05* works.
> Searches on another word cq6r work fine.
>  Any idea why this is happening?

Works just fine for me. Test program attached.


--
Ian.

----------------------------------------------------------------------
Searchable personal storage and archiving from http://www.digimem.net/
import org.apache.lucene.queryParser.*; 
import org.apache.lucene.search.*; 
import org.apache.lucene.index.*; 
import org.apache.lucene.analysis.*; 
import org.apache.lucene.analysis.standard.*;
import org.apache.lucene.document.*; 
import org.apache.lucene.store.*;


public class LuceneTest { 
    
    RAMDirectory ramdir;
    Analyzer analyzer;
    IndexWriter writer;
    IndexReader reader;
    Searcher searcher;

    public LuceneTest() {
        analyzer = new StandardAnalyzer(); 
        ramdir = new RAMDirectory();
    }


    public static void main(String args[]) throws Exception { 
        LuceneTest ld = new LuceneTest();
        ld.load();
        ld.search();
    }
    
    
    void load() throws Exception {
        writer = new IndexWriter(ramdir, analyzer, true); 
        add("05qzFebqz01");
        writer.close();
    }   
    
    
    
    void add(String s) throws Exception {
        Document d = new Document();
        d.add(Field.Text("text", s));
        System.out.println("Adding "+s);
        writer.addDocument(d);
    }
    
    

    void search() throws Exception {
        reader = IndexReader.open(ramdir);
        searcher = new IndexSearcher(reader);
        search("05qzFebqz01");
        search("05q*");
        search("05*");
    }


    void search(String s) throws Exception {
        Query query = QueryParser.parse(s, "text", analyzer);
        Hits hits = searcher.search(query);
        System.out.println(s+" matched "+hits.length());
        for (int i = 0; i < hits.length(); i++) {
            System.out.println("    " + 
                               hits.doc(i).get("text"));
        }
    }
}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to