Hi all again,
what am I missing?
I add a Document to an Index and immediatly after this I'm searching
for this doc, but get 0 results.
What am I doing wrong there? Do I need to flush? Really? Or create the
Searcher after the addDocument?
In my app I'm indexing a lot of stuff, and have to check, if certain
docs are already present - so how would I do this?
Henning
#include <iostream>
#include "boost/scoped_ptr.hpp"
#include "CLucene.h"
using namespace lucene::analysis;
using namespace lucene::index;
using namespace lucene::document;
using namespace lucene::search;
using boost::scoped_ptr;
int main(void) {
SimpleAnalyzer a;
IndexWriter w(".",&a,true);
IndexSearcher s( w.getDirectory() );
Document d;
d.add( *new Field(L"name", L"value", Field::INDEX_UNTOKENIZED ));
w.addDocument( &d );
TermQuery q( new Term(L"name", L"value"));
scoped_ptr<Hits> h( s.search(&q) );
std::cout << h->length() << std::endl;
w.close();
}
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
CLucene-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clucene-developers