lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Stephan.H...@arvato-mobile.de>
Subject AW: Lucene ignoring query to a field containing single character values
Date Mon, 02 Jun 2008 15:58:34 GMT
Hi ryan,

I guess you use the StandardAnalyzer with standard constructor. The standard analyzer uses
a list of stopwords. And "a" is within this list. So if the StandardAnalyzer sees the token
"a" he ignores it.

I think a possible Solution would be to use a PerFieldAnalyzerWrapper to use a KeywordAnalyzer/SimpleAnalyzer
for this field.

Using the standardanalyzer with second query will result in the same query like above. Just
businessName:toys is used for searching. So the result must be the same.

I hope this helps you.

Greetings Stephan

-----Urspr√ľngliche Nachricht-----
Von: ryan catambing [mailto:ryan.catambing@gmail.com] 
Gesendet: Montag, 2. Juni 2008 17:47
An: java-user@lucene.apache.org
Betreff: Lucene ignoring query to a field containing single character values

Hi All,


I am using Lucene-core-2.3.2.

One of the fields that I have indexed with Lucene contains a single
character value which stands for a code.  When I make queries using a
StandardAnalyzer lucene is ignoring queries against the said field when
using the required operator (+), however when trying out the reverse of the
condition using the prohibit operator (-) it works ok.

Below is a sample of the lucene query:

//This does not work. It just ignores the industrial codes and shows
documents with the term toys
+industrialCode:a +businessName:toys

//Trying out the opposite -- this works shows documents not having the
industrial code "a"
-industrialCode:a +businessName:toys

Any enlightenment would be appreciated.

Thanks,

Ryan

---------------------------------------------------------------------
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