Without a thorough investigation, it looks like an analyzer misunderstanding. The simpleanalyzer used a lowercase filter. So your tokenised term is being added as lowercase value which doesn't match the 'Value' string you are searching for
As a general rule, always use the same analyzer on the indexing side of things as the querying side else you'll get unexpected results. Hope that helps Ben Sent from my iPhone On 19/11/2009, at 4:04 AM, Henning Meyer <tutm...@gmail.com> wrote: > I'm a newbie to CLucene and using CLucene from git (checkout > 48f7a9017606b85b2ee9b96b04c0720d2ea91e54). > I may not understood it correctly but my WildcardQueries seem not to > work as expected when turning on Tokenization with SimpleAnalyzer. > To demonstrate the behaviour I attached this small program: > > #include <iostream> > #include <string> > #include "CLucene.h" > > using namespace lucene::analysis; > using namespace lucene::index; > using namespace lucene::document; > using namespace lucene::search; > > int main(void) { > SimpleAnalyzer a; > IndexWriter w(".",&a,true); > Document *d1 = new Document; > Document *d2 = new Document; > Field f1( L"name1", L"Value", Field::INDEX_TOKENIZED ); > Field f2( L"name2", L"Value", Field::INDEX_UNTOKENIZED); > d1->add( f1 ); > d2->add( f2 ); > w.addDocument( d1 ); > w.addDocument( d2 ); > w.flush(); > IndexSearcher s( w.getDirectory() ); > WildcardQuery q1( new Term(L"name1", L"Value*")); > Hits *h1 = s.search(&q1); > std::cout << h1->length() << std::endl; > delete h1; > WildcardQuery q2( new Term(L"name2", L"Value*")); > Hits *h2 = s.search(&q2); > std::cout << h2->length() << std::endl; > delete h2; > } > > compile: > g++ -c -o ltest.o ltest.cc > cc -lclucene-core ltest.o -o ltest > > run: > ./ltest > > Output should be: > 1 > 1 > But: Output actually is: > 0 > 1 > > Any Idea why the first Query is not able to find name1:Value? > > Thanks a lot! > > Henning > > --- > --- > --- > --------------------------------------------------------------------- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > CLucene-developers mailing list > CLucene-developers@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/clucene-developers ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ CLucene-developers mailing list CLucene-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/clucene-developers