lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Doubt in FuzzyQuery
Date Tue, 08 May 2007 11:57:19 GMT

Last week I send a message with a doubt in a FuzzyQuery. I am working with
Lucene 2.1.0.

I would like to recover files including the set of strings

"société américaine" and "sociétés américaines"

from a fuzzy query relating the string "société américain"

I create a method "getDocuments" and I call it with the query introducing by the
user. For example, in this case:


the variable "query" is equal to "société américain".

Bellow you can see the code of the method:

private void getDocuments(String queryString)
	Directory dir=FSDirectory.getDirectory(pathIndexador);
	IndexSearcher searcher=new IndexSearcher(dir);
	File stopWordsFile=new File(fichStopW);
	Analyzer analyzer=new StopAnalyzer(stopWordsFile);
	QueryParser queryParse=new QueryParser("contenido", analyzer);
	Query query=queryParse.parse(queryString);
	PhraseQuery pq=(PhraseQuery)query;
	Term [] term=pq.getTerms();
	SpanTermQuery[] clausulas=new SpanTermQuery[term.length];
	for(int i=0;i<clausulas.length;i++)
		clausulas[i]=new SpanTermQuery(term[i]);
	SpanNearQuery queryspanNormal= new SpanNearQuery(clausulas,2,true);

Can you help me?



Servicio de acceso ó correo electrónico vía web da Universidade de Vigo
Servicio de acceso al correo electrónico vía web de la Universidad de Vigo

Servicios Informáticos [ ]
Universidade de Vigo [ ]


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message