Quite interesting (I think), if I use lucene api to perform the query I get
exactly what I'm expecting...
Searcher searcher = new IndexSearcher(indexDir);
Analyzer analyzer = new NutchDocumentAnalyzer();
Query query = QueryParser.parse("a3d32ce0cae0da47677f30cc6182d421",
"quiewId", analyzer);
System.out.println(query);
System.out.println("Searching for: " + query.toString("quiewId"));
Hits hits = searcher.search(query);
System.out.println(hits.length() + " total matching documents");
Do you have any suggestion?
Thanks,
Enrico
On 1/31/06, Enrico Triolo <[EMAIL PROTECTED]> wrote:
>
> No... :-(
> What would it be supposed to do?
>
> Enrico
>
> On 1/31/06, Stefan Groschupf <[EMAIL PROTECTED]> wrote:
> >
> > What happens if you change your query string to:
> > String query = "quiewId:a3d32ce0cae0da47677f30cc6182d421 HTTP" ;
> > (adding space http)??
> > Does this return any hits?
> >
> > Stefan
> >
> > Am 31.01.2006 um 12:05 schrieb Enrico Triolo:
> >
> > > Hi all, I developed a couple of plugins to add and search a custom
> > > field.
> > > The indexing plugin works fine (with Luke I can see the field is
> > > added to
> > > the index). But when it comes to search no documents are returned...
> > >
> > > Here the plugins code:
> > >
> > > ----------------- Indexing plugin ---------------------------
> > >
> > > package org.apache.nutch.indexer.quiew;
> > >
> > > import ...;
> > >
> > > public class QuiewIndexingFilter implements IndexingFilter {
> > >
> > > public Document filter(Document doc, Parse parse, FetcherOutput fo)
> > > throws IndexingException {
> > >
> > > String url = fo.getUrl().toString();
> > > doc.add(new Field("quiewId", MD5Hash.digest(url).toString(),
> > > true, true,
> > > false));
> > >
> > > return doc;
> > > }
> > >
> > > }
> > >
> > > ---------------- Query plugin ----------------------
> > > package org.apache.nutch.searcher.quiew;
> > >
> > > import org.apache.nutch.searcher.FieldQueryFilter ;
> > >
> > > public class QuiewQueryFilter extends FieldQueryFilter {
> > >
> > > public QuiewQueryFilter() {
> > > super("quiewId");
> > > }
> > > }
> > >
> > > And here's how I try to perform the query:
> > >
> > > String query = "quiewId:a3d32ce0cae0da47677f30cc6182d421";
> > > NutchBean bean = new NutchBean(new File(indexPath));
> > > Query q = Query.parse(query);
> > > Hits hits = bean.search(q, 1000);
> > > long tot = hits.getTotal();
> > >
> > > System.out.println("Query returned " + tot + " hits.");
> > >
> > > for(int i = 0; i < tot; i++) {
> > >
> > > Hit hit = hits.getHit(i);
> > > HitDetails details = bean.getDetails(hit);
> > >
> > > System.out.println("Resource title: " + details.getValue("title"));
> > > System.out.println("Resource url: " + details.getValue("url"));
> > > }
> > >
> > > If I perform the same query with Luke, I get correct results, but
> > > only if I
> > > use the KeywordAnalyzer...
> > >
> > > What am I doing wrong?
> > >
> > > Thanks,
> > > Enrico
> >
> >
>