You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@nutch.apache.org by Jeet Singh <je...@gmail.com> on 2008/03/29 16:17:02 UTC

Not a known field error

Hi,

I created a webpages index using Nutch-0.9, while indexing I added a 
field named *s3-type* in each document.
At the time of searching, I'm able to see the same field name and 
related value in each hit retreived but the issue
is that when I try to call addRequiredField to the query, it throws 
error (at runtime) that field s3-type is not a known field.

Here is the code for adding the field at indexing time (in a plugin 
extended from IndexingFilter):-
     doc.add(new Field("s3-type", "some value", Field.Store.YES, 
Field.Index.TOKENIZED));

This is the code during searching (when I try to add a field as required 
field to query):-
     Query newQuery = Query.parse("dummy query", <conf object here>);
     newQuery.addRequiredTerm("value", "s3-type");
     Hits hits = <index searcher obj here>.search(newQuery, 300, null, 
null, false);

I'm able to search properly for all normal queries, the problem comes 
only when I try to do addRequiredTerm

Basically I need to filter the results based on a particular field 
(s3-type in this case).

Please help
Thanks
Jeet Singh




Issue in parsing the query

Posted by Jeet Singh <je...@gmail.com>.
Hi,

I've a small program which opens a nutch index and performs searches.
While indexing, I've added a new field "myfield" in every document.

Now whenever I try to call addRequiredField to the Query object, it 
throws the error
at runtime that: Field "myfield" is not known

I've been told that Query.parse() needs to know all the supported fields 
in advance and I can
mention that in the plugin.xml

But the issue is that I'm not using a plugin to search, I've written a 
small search program which opens the index and
searches. So where can I tell Query.parse() about my field "myfield" ?

I'm new to Nutch and I'm unable to solve it by myself.
Please help

Thanks
Jeet Singh

Controlling no. of pages to crawl

Posted by Jeet Singh <je...@gmail.com>.
Hi,

Can I put a limit that while crawling for whole-web, (not using crawl 
command) it should fetch only x no. of pages?
I need this limit in every crawl session.

Thanks
Jeet Singh

Re: Not a known field error

Posted by Andrzej Bialecki <ab...@getopt.org>.
Jeet Singh wrote:
> Hi,
> 
> I created a webpages index using Nutch-0.9, while indexing I added a 
> field named *s3-type* in each document.
> At the time of searching, I'm able to see the same field name and 
> related value in each hit retreived but the issue
> is that when I try to call addRequiredField to the query, it throws 
> error (at runtime) that field s3-type is not a known field.
> 
> Here is the code for adding the field at indexing time (in a plugin 
> extended from IndexingFilter):-
>     doc.add(new Field("s3-type", "some value", Field.Store.YES, 
> Field.Index.TOKENIZED));
> 
> This is the code during searching (when I try to add a field as required 
> field to query):-
>     Query newQuery = Query.parse("dummy query", <conf object here>);
>     newQuery.addRequiredTerm("value", "s3-type");
>     Hits hits = <index searcher obj here>.search(newQuery, 300, null, 
> null, false);
> 
> I'm able to search properly for all normal queries, the problem comes 
> only when I try to do addRequiredTerm
> 
> Basically I need to filter the results based on a particular field 
> (s3-type in this case).

Query.parse() needs to know in advance about all fields supported by the 
query, so that the field names are not treated as ordinary tokens. You 
do this by declaring supported fields in query plugins' plugin.xml 
descriptors. See how it's done in other query plugins.

-- 
Best regards,
Andrzej Bialecki     <><
  ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com