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:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to