lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject Re: StandardFilter not handling dots as exptected ?
Date Thu, 06 Aug 2009 14:57:19 GMT
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?

On Thu, Aug 6, 2009 at 5:45 PM, Paul Taylor <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
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message