meriems / luke

Automatically exported from code.google.com/p/luke
0 stars 0 forks source link

~ usage is throwing exception when used in lukeall. #53

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create index for lucene 2.9.4 test. Use this steps to make it:
DirectoryInfo di = new DirectoryInfo(@"c:\index");
            index = FSDirectory.Open(di);
            if (!di.Exists)
            {
                IndexWriter writer = new IndexWriter(index, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
                writer.SetSimilarity(sim);

                // hed is the most important field, dek is secondary

                // d1 is an "ok" match for:  albino elephant
                {
                    Document d1 = new Document();
                    d1.Add(new Field("id", "d1", Field.Store.YES, Field.Index.NOT_ANALYZED)); //Field.Keyword("id", "d1"));
                    d1.Add(new Field("hed", "elephant", Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("hed", "elephant"));
                    d1.Add(new Field("dek", "elephant", Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("dek", "elephant"));
                    writer.AddDocument(d1);
                }

                // d2 is a "good" match for:  albino elephant
                {
                    Document d2 = new Document();
                    d2.Add(new Field("id", "d2", Field.Store.YES, Field.Index.NOT_ANALYZED)); //Field.Keyword("id", "d2"));
                    d2.Add(new Field("hed", "elephant", Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("hed", "elephant"));
                    d2.Add(new Field("dek", "albino", Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("dek", "albino"));
                    d2.Add(new Field("dek", "elephant", Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("dek", "elephant"));
                    writer.AddDocument(d2);
                }

                // d3 is a "better" match for:  albino elephant
                {
                    Document d3 = new Document();
                    d3.Add(new Field("id", "d3", Field.Store.YES, Field.Index.NOT_ANALYZED)); //Field.Keyword("id", "d3"));
                    d3.Add(new Field("hed", "albino", Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("hed", "albino"));
                    d3.Add(new Field("hed", "elephant", Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("hed", "elephant"));
                    writer.AddDocument(d3);
                }

                // d4 is the "best" match for:  albino elephant
                {
                    Document d4 = new Document();
                    d4.Add(new Field("id", "d4", Field.Store.YES, Field.Index.NOT_ANALYZED)); //Field.Keyword("id", "d4"));
                    d4.Add(new Field("hed", "albino", Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("hed", "albino"));
                    d4.Add(new Field("hed", "elephant", Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("hed", "elephant"));
                    d4.Add(new Field("dek", "albino", Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("dek", "albino"));
                    writer.AddDocument(d4);
                }

                writer.Close();
            }
            r = IndexReader.Open(index);
            s = new IndexSearcher(r);
2. Open created index as read-only in lukeall 3.1.0.
3. Perform next search: (hed:albino | dek:albino)~0.01 (hed:elephant | 
dek:elephant)~0.01

What is the expected output? What do you see instead?
Expected is returned result, right now only exception is displayed, with 
message explaining what is expected.

What version of the product are you using? On what operating system?
3.1.0 lukeall, index is created as both 2.9.4. Windows 7 professional.

Original issue reported on code.google.com by b.sa...@4expand.com on 30 Dec 2011 at 9:52