lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Taylor <paul_t...@fastmail.fm>
Subject Re: StandardFilter not handling dots as exptected ?
Date Thu, 06 Aug 2009 15:01:42 GMT
Shai Erera wrote:
> I see you index R.E.S. and search for R.E.S (note the dot that's 
> missing in the query at the end). Can you try to query w/ the dot?
Yes if you search with the dot it works (i mentioned this in the first 
email) so it appears when the field is being indexed its no tremoving 
the last dot.
>
> On Thu, Aug 6, 2009 at 5:45 PM, Paul Taylor <paul_t100@fastmail.fm 
> <mailto:paul_t100@fastmail.fm>> wrote:
>
>     Erick Erickson wrote:
>
>         I don't see anything obvious in the code.
>
>         Are you using the same analzer at query time as at index time?
>
>     Yes, I do I have created a testcase now, that fails
>
>
>     import org.apache.lucene.analysis.Analyzer;
>     import org.apache.lucene.store.RAMDirectory;
>     import org.apache.lucene.index.IndexWriter;
>     import org.apache.lucene.document.Document;
>     import org.apache.lucene.document.Field;
>     import org.apache.lucene.search.IndexSearcher;
>     import org.apache.lucene.search.Query;
>     import org.apache.lucene.search.Hits;
>     import org.apache.lucene.queryParser.QueryParser;
>     import junit.framework.TestCase;
>
>     public class RESTest extends TestCase {
>       public void testMatchAcronymns() throws Exception {
>           Analyzer analyzer = new StandardUnaccentAnalyzer();
>           RAMDirectory dir = new RAMDirectory();
>           IndexWriter writer = new IndexWriter(dir, analyzer, true,
>     IndexWriter.MaxFieldLength.LIMITED);
>           Document doc = new Document();
>           doc.add(new Field("name", "R.E.S.", Field.Store.YES,
>     Field.Index.ANALYZED));
>           writer.addDocument(doc);
>           writer.close();
>
>           IndexSearcher searcher = new IndexSearcher(dir);
>           Query q = new QueryParser("name", analyzer).parse("R.E.S");
>           System.out.println(q.toString());
>           Hits hits = searcher.search(q);
>           assertEquals(1, hits.length());
>
>       }
>     }
>
>
>         I'd also get a copy of Luke and examine your index to see what
>         is actually getting put in it, and query.toString might help.
>
>     Query to string returns
>     name:r.e.s
>
>     Paul
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>     <mailto:java-user-unsubscribe@lucene.apache.org>
>     For additional commands, e-mail: java-user-help@lucene.apache.org
>     <mailto:java-user-help@lucene.apache.org>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message