lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ismail Siddiqui" <ism...@gmail.com>
Subject Re: TermQuery and PhraseQuery..problem with word with space
Date Mon, 09 Oct 2006 15:59:39 GMT
I am using StandardAnalyzer while indexing the field..
I  am also a creatign a field called full_text in which i am adding all
these individual  fields as TOKENIZED.


here is the code

while(choiceIt.hasNext()){
          PersonProfileAnswer pa=(PersonProfileAnswer)choiceIt.next();
            if(pa.getPersonProfileChoice()!=null)
            {
                        doc.add(new Field(FULL_TEXT,
pa.getPersonProfileChoice().getChoice(),Field.Store.NO,Field.Index.TOKENIZED
));
             LuceneProfileQuestion lpf=this.getLuceneProfileQuestion(
pa.getPersonProfileChoice().getPersonProfileQuestion().getId());

                  doc.add(new Field(lpf.getLuceneFieldName(),
pa.getPersonProfileChoice().getChoice(),Field.Store.NO,
Field.Index.UN_TOKENIZED));

            }
         }

when i use luke i can see the term is there.. e.g.  for a lucence field
called "fav_stores" UN_TOKENIZED terms "Ann Taylor" and "Banana Republic"
are there..



If i make a search on full_text.. and type "banana" or "republic" or
"banana republic" i get the doucment as result..  In my java class i am
using phrasequery for full_text and termquery for each individual filed..

e.g. TermQuery subjectQuery=new TermQuery(new Term("fav_stores",favStores));


In luke i do not  see any option to select query type but when I make search
on "fav_stores" with term "Banana Republic"  there is no result.


On 10/9/06, Doron Cohen <DORONC@il.ibm.com> wrote:
>
> > I am trying to index a field which has more than one word with space e.g
> .
> > "My Word"
> > i am indexng it UN_TOKENIZED .. but when i use TermQuery to query "My
> Word"
> > its not yielding any result..
>
> Seems that it should work.
>
> Few things to check:
> - make sure you are indexing with UN_TOKENIZED.
> - check that either both field and query text are lower-cased or both are
> not lower-cased.
> - use Luke to examine the content of the index (when adding as
> un-tokenized);
> print the query (toString);
> - do they match each other? match your expectation?
>
> >
> > Is term qurey limited to one word? i mean if we index a word with space
> and
> > index it UN_TOKENIZED..
> > shouldnt TermQuery yeild result to "My Word".
> >
> >
> > Ismail
>
> There is no such limitation.
>
> Hope this helps,
> Doron
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message