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:

getDocuments("\""+query+"\"~");

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);
        queryParse.setFuzzyMinSim(0.5f);
        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);
        Hits hitsNormal=searcher.search(queryspanNormal,Sort.RELEVANCE);
}

Can you help me?

Regards.

--oOo-----------------------------------------------------------------oOo--

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 [ http://si.uvigo.es ]
Universidade de Vigo [ http://www.uvigo.es ]

URL: https://correoweb.uvigo.es


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to