lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Lennon" <niall_len...@hotmail.com>
Subject MultiFieldQueryParser & Phrases Problem
Date Sun, 21 Sep 2003 22:13:58 GMT
I'm currently using the MultiFieldQueryParser to search across four fields. 
I'm searching for phrases so i've wrapped my search text in quotes... 
everything worked
fine until i tried to execute a search ending with the 'A' and for some 
reason the A and quotes are ignored e.g.:


Analyzer analyzer = new StandardAnalyzer();
Searcher searcher = new IndexSearcher(IndexReader.open("dbindex"));

String[] fields = {"code_field", "short_description_field", 
"category_field", "manufacturer_field"};
int[] flags = {MultiFieldQueryParser.NORMAL_FIELD, 
MultiFieldQueryParser.NORMAL_FIELD, MultiFieldQueryParser.NORMAL_FIELD, 
MultiFieldQueryParser.NORMAL_FIELD};

Query query =    MultiFieldQueryParser.parse("\"Category A\"", fields, 
flags, analyzer);

System.out.println("query -> " + query);

Hits hits = searcher.search(query);



The System output for the above is as follows:
code_field:category short_description_field:category category_field:category 
manufacturer_field:category



If i execute the same code with the following search text i get the expected 
results:
Query query =    MultiFieldQueryParser.parse("\"Category Z\"", fields, 
flags, analyzer);


code_field:"category z" short_description_field:"category z" 
category_field:"category z" manufacturer_field:"category z"



I' appreicate any help with regards this matter...

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail


Mime
View raw message