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

Reply via email to