lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: partial search
Date Wed, 07 Nov 2001 15:23:17 GMT
Yes, and here is the explanation, if you are interested:
http://www.jguru.com/faq/view.jsp?EID=538312

Otis

--- Christophe <cgd@free.fr> wrote:
> After some test, I found there was a difference between "tes*" and
> "TES*".
> It seems to not work with uppercase and *.
> however it works fine with "test" and "TEST".
> It happend only with the '*'.
> 
> -----
> Christophe
> 
> ----- Message d'origine -----
> De : "Ian Lea" <ian.lea@blackwell.co.uk>
> À : "Lucene Users List" <lucene-user@jakarta.apache.org>;
> <cgd@free.fr>
> Envoyé : mardi 6 novembre 2001 22:51
> Objet : Re: partial search
> 
> 
> > > How could I make a search with something like "tes*" for test,
> testing,
> ...?
> > >
> > > Currently, I use a StandardAnalyzer for indexing and searching
> (with
> query
> > > parser), and it doesn't work.
> > > Do I need to use another analyser ?
> >
> > I don't think so.  The short program below works for me with
> lucene-1.2-rc2.
> >
> >
> > --
> > Ian.
> > ian.lea@blackwell.co.uk
> >
> >
> > import org.apache.lucene.queryParser.*;
> > import org.apache.lucene.search.*;
> > import org.apache.lucene.index.*;
> > import org.apache.lucene.analysis.*;
> > import org.apache.lucene.analysis.standard.*;
> > import org.apache.lucene.document.*;
> >
> >
> > public class Test {
> >
> >     public static void main(String args[]) throws Exception {
> > Analyzer analyzer = new StandardAnalyzer();
> > IndexWriter writer = new IndexWriter("test", analyzer, true);
> > Document d;
> > d = new Document();
> > d.add(Field.Text("word", "test"));
> > writer.addDocument(d);
> > d = new Document();
> > d.add(Field.Text("word", "testing"));
> > writer.addDocument(d);
> > writer.close();
> > IndexReader reader = IndexReader.open("test");
> > Searcher searcher = new IndexSearcher(reader);
> > String s = "test*";
> > if (args.length > 0) { s = args[0]; }
> > Query query = QueryParser.parse(s, "word", analyzer);
> > Hits hits = searcher.search(query);
> > for (int i = 0; i < hits.length(); i++) {
> >     System.out.println(hits.doc(i).get("word"));
> > }
> >     }
> > }
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-user-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message