Greetings,
I'm getting a strange behaviour when using the FrenchAnalyzer.
Calling the same class (Searcher.java, see below) from a JSP file and from a
Java class, gives differents results when the query contains accents !
Notice the different value of the query object :
q = "secrétaire"
If calling from main.jsp query = text:secrétair
If calling from main.java query = text:secretair
Source code (Search.java, Main.jsp, Main.java) :
public void search() {
String q = "secrétaire";
String indexDirectory = "c:\\temp\\accent\\index2";
try {
IndexSearcher searcher = new IndexSearcher(indexDirectory);
QueryParser parser = new QueryParser("text", new
FrenchAnalyzer());
Query query = parser.parse(q);
Hits hits = searcher.search(query);
System.out.println(query);
System.out.println("Results for '" + q + "': " +
hits.length());
Iterator iter = hits.iterator();
while (iter.hasNext()) {
Hit hit = (Hit) iter.next();
Document doc = hit.getDocument();
}
} catch (Exception e) {
}
}
=====================Main.jsp=====================
<%
Search s = new Search();
s.search();
%>
OUPUT :
text:secrétair
Results for 'secrétaire': 0
=====================Main.java=====================
public class Main {
public static void main(String[] args) {
Search s = new Search();
s.search();
}
}
OUTPUT :
text:secretair
Results for 'secrétaire': 1
I will appreciate your help, thank you in advance.
Lamine
--
View this message in context:
http://www.nabble.com/Strange-behaviour-of-FrenchAnalyzer-when-using-accents-tp20392978p20392978.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]