lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Willnauer" <simon.willna...@googlemail.com>
Subject Re: research lucene
Date Thu, 10 Aug 2006 12:57:47 GMT
I just tried it out and it worked like expected:


   RAMDirectory d = new RAMDirectory();
    IndexWriter w = new IndexWriter(d,new WhitespaceAnalyzer(),true);

    Document doc = new Document();
    doc.add(new Field("field","title",Field.Store.YES,Field.Index.TOKENIZED ));
    doc.add(new Field("field","2006",Field.Store.YES,Field.Index.TOKENIZED ));
    w.addDocument(doc);

    w.close();
    IndexSearcher s = new IndexSearcher(d);
    System.out.println("Search for title: "+s.search(new TermQuery(new
Term("field","title"))).length());
    System.out.println("Search for 2006: "+s.search(new TermQuery(new
Term("field","2006"))).length());

Output:

Search for title: 1
Search for 2006: 1

I actually can't really get your problem.

regards simon

On 8/10/06, ould sid'ahmed <nouldsid@emn.fr> wrote:
>
> The probl add(new Field(  fieldName(), fieldValue, Field.Store,
> Field.Index));
> and I use the WhiteSpaceAnalyser, but my problem is can I index a field
> with value as "title" it goes, and can I index with value as "2006" it
> doesn't go.
> Why, I don't know
> thanks
> Simon Willnauer a écrit :
> > could you provide a bit more info on your index process?
> > (analyzer,Field, Store, Index)
> >
> > regards simon
> >
> > On 8/10/06, ould sid'ahmed <nouldsid@emn.fr> wrote:
> >>
> >> Hello,
> >> I don't know why it don't index the number values, I look with Luke
> >> Lucene, I founded that values numerics didn't indexed.
> >> can you know what the problem?
> >>
> >> thanks
> >> Simon Willnauer a écrit :
> >> > Well your digits might be lost during analysis like Erik said. Check
> >> > out with luke whats in your index (Field.Store.Yes) and see if your
> >> > analyzer removes the digits. SimpleAnalyzer removes them but
> >> > StandartAnalyzer keeps the digits.
> >> >
> >> > regards simon
> >> >
> >> > On 8/9/06, ould sid'ahmed <nouldsid@emn.fr> wrote:
> >> >> Simon Willnauer a écrit :
> >> >> > You should rather explain what you expect from indexing your number
> >> >> > not as string values.
> >> >> >
> >> >> > best regards simon
> >> >> >
> >> >> > On 8/9/06, ould sid'ahmed <nouldsid@emn.fr> wrote:
> >> >> >> Erick Erickson a écrit :
> >> >> >> > What analyzers are you using for both indexing and searching?
> >> Some
> >> >> >> > analyzers
> >> >> >> > strip out numbers and some don't. I'd start with
> >> >> >> WhitespaceAnalyzer, and
> >> >> >> > index your fields UN_TOKENIZED and work up to the other
> >> analyzers
> >> >> >> and/or
> >> >> >> > tokenizations from there.
> >> >> >> >
> >> >> >> > Under any circumstances, you really, really, really want
to
> >> get a
> >> >> >> copy of
> >> >> >> > Luke (http://www.getopt.org/luke/) which will allow you
to
> >> examine
> >> >> >> your
> >> >> >> > index to see what it actually contains. I've been surprised
more
> >> >> than
> >> >> >> > once
> >> >> >> > by thinking that my index contained something it really
hadn't.
> >> >> >> >
> >> >> >> > Best
> >> >> >> > Erick
> >> >> >> >
> >> >> >> > On 8/9/06, ould sid'ahmed <nouldsid@emn.fr> wrote:
> >> >> >> >>
> >> >> >> >> Hello,
> >> >> >> >>
> >> >> >> >> I don't arrive to get result from the field have
a value
> >> >> numeric for
> >> >> >> >> example "date=2005" or "title=900",
> >> >> >> >> I have indexed the fields "date" with String value.
I want know
> >> >> why?
> >> >> >> >>
> >> >> >> >> Can you help me?
> >> >> >> >>
> >> >> >> >> thanks.
> >> >> >> >>
> >> >> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> >> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> >> >> >> For additional commands, e-mail:
> >> java-user-help@lucene.apache.org
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> thanks for your response and your soft,
> >> >> >> you think what about the indexer that can resolve my problem.
> >> >> >> my problem is the indexer, it don't index value numeric.
> >> >> >>
> >> >> >> thanks.
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> >> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >> >> >>
> >> >> >>
> >> >> >
> >> >> I  add my document
> >> >> Document doc=new Document();
> >> >> doc.add(new Field( getName(), value, getStore(), getIndex()));
> >> >> and getName can be "date, name, tilte, or another", but can if I
> >> index
> >> >> title with the value "122" or another, It can't return me a
> >> result, if I
> >> >> index title with "mytitre" for example, it return me the result, I
> >> would
> >> >> like why?
> >> >>
> >> >> thanks.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >> >>
> >> >>
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Mime
View raw message