lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alain Lauzon <alau...@libertefinanciere.com>
Subject Re: AW: Cannot match field containing value "No"
Date Wed, 22 Jan 2003 19:47:58 GMT
Finally I was fed up and I manually parsed the state field and put 
"ontario" when
it was "ON" and so on for "OR" and "IN".  I did the same parse for the 
query and
reversed the parse when displaying the state field so that it will display 
ON and
not ontario.

I do not understand what is the bug but I countoured it.

Alain Lauzon

At 13:28 2003-01-22 -0500, you wrote:
>That's what I did.  ;-(
>
>At 10:24 2003-01-22 -0800, you wrote:
>>You don't say whether you threw away the old index or if you switched
>>the Analyzer on an existing index.
>>You should throw the old index away and reindex all of your docs with
>>an Analyzer that handles ON, OR, IN, etc.
>>
>>Otis
>>
>>
>>--- Alain Lauzon <alauzon@libertefinanciere.com> wrote:
>> > I am having the same problem with words "ON", "OR" and "IN",
>> > standing for, Ontario, Oregon and Indiana.  I have created my own
>> > Analyzer and remove the stop word "on", "or" and "in" and I have
>> > the same results.
>> >
>> > Is there another place in the code that is using those stop words ?
>> >
>> > Anybody with the same problem ?
>> >
>> > Alain Lauzon
>> >
>> >
>> > At 11:54 2003-01-22 +0100, you wrote:
>> > >Hello,
>> > >
>> > > > I seem to be having trouble matching the value "No". The
>> > > > snippet of my insert index code looks like this:
>> > > > --------------------
>> > > > IndexWriter writer = new IndexWriter("indexTest", new
>> > > > StandardAnalyzer(), true);
>> > > > Document doc = new Document();
>> > > > doc.add(Field.Text("YesNo", choice));
>> > > > writer.addDocument(doc);
>> > > > writer.optimize();
>> > > > writer.close();
>> > > > -------------------
>> > > > where the value of the variable choice is either a "Yes" or a
>> > "No"
>> > > > and the code to search it looks like this :
>> > > >
>> > > > ---------------------
>> > > > IndexSearcher searcher = new
>> > > > IndexSearcher(IndexReader.open("indexTest"));
>> > > > Analyzer analyzer = new StandardAnalyzer();
>> > > > Query query =
>> > > > org.apache.lucene.queryParser.QueryParser.parse(queryString,
>> > > > "YesNo", analyzer);
>> > > > Hits hits = searcher.search(query);
>> > > > System.out.println("Found "+hits.length()+" match");
>> > > >
>> > > > ---------------------
>> > > > where the value of queryString contains the user input which
>> > > > is wither a "Yes" or "No"
>> > > >
>> > > >
>> > > > Whenever I insert a "No", I would not be able to retrieve it
>> > > > (the output will show 0 mtaches) even though I use the same
>> > > > analyzer. Any other values like "Yes","n","y" would get hits.
>> > > >  Has anyone went through similar errors? Is this a bug or is
>> > > > it some limitation, where lucene can't accept string values
>> > > > of "No"? Or am i missing something?
>> > > >
>> > >
>> > >The StandardAnalyzer uses a small list of english stop words. These
>> > are
>> > >common word, which will be ignored, e.g. "no" or "a". Checkout
>> > >org.apache.lucene.analysis.standard.StandardAnalyser for the full
>> > list.
>> > >
>> > >You have to write your own analyzer. This is very easy: Copy the
>> > code from
>> > >StandardAnalyzer to your own class and remove the StopFilter or
>> > change
>> > >the list of Stopwords. Don't forget to rebuild your index after
>> > this.
>> > >Regards,
>> > >         Wolf-Dietrich
>> > >
>> > >--
>> > >Wolf-Dietrich Materna
>> > >Development
>> > >
>> > >empolis GmbH -  arvato knowledge management
>> > >Kekul├ęstr. 7
>> > >12489 Berlin, Germany
>> > >
>> > >phone :  +49-30-6780-6510
>> > >fax :    +49-30-6780-6549
>> > >
>> > ><<mailto:Wolf-Dietrich.Materna@empolis.com>>
>> > <<http://www.empolis.com>>
>> > >
>> > >--
>> > >To unsubscribe, e-mail:
>> > <mailto:lucene-user-unsubscribe@jakarta.apache.org>
>> > >For additional commands, e-mail:
>> > <mailto:lucene-user-help@jakarta.apache.org>
>> >
>> >
>> >
>> > --
>> > To unsubscribe, e-mail:
>> > <mailto:lucene-user-unsubscribe@jakarta.apache.org>
>> > For additional commands, e-mail:
>> > <mailto:lucene-user-help@jakarta.apache.org>
>> >
>>
>>
>>__________________________________________________
>>Do you Yahoo!?
>>Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
>>http://mailplus.yahoo.com
>>
>>--
>>To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message