You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@nutch.apache.org by Kumar Limbu <ku...@gmail.com> on 2005/12/14 10:58:10 UTC

About Writing Custom queryFilter

Hi everyone,

I am trying to write a custom plugin which will insert ( field and value)
pair into the indexed webpages depending upon its content. I have
successfully written the plugin for parsing the data and then inserting
custom information based on the contents. What I couldn't do is write a
custom query filter which will return results based only on that particular
field.

I saw the code for urlQueryFilter but I wasn't able to understand it very
well.

If you guys can help me I will be very grateful. Thank you everyone.

--
Keep on smiling
:) Kumar

Re: About Writing Custom queryFilter

Posted by Kumar Limbu <ku...@gmail.com>.
Hi,

Thank You, now I can run a custom queryfilter!




On 12/15/05, Stefan Groschupf <sg...@media-style.com> wrote:
>
> Is your plugin included in the nutch-default.xml? Is it in the
> correct plugin folder?
> When starting tomcat you can see the activated plugins in the log.
> Stefan
>
> Am 15.12.2005 um 11:04 schrieb Kumar Limbu:
>
> > Hi Everyone,
> >
> > Thank you stefen for your help. But I just don't seem to be able to
> > implement it correctly. I am quite new to nutch and I am using the
> > default
> > nutch war file to search the index.
> >
> > I extended the RawFieldQueryFilter to create a MyQueryFilter. I
> > refered to
> > the query-site to create the plugin.xml file.
> >
> > I built nutch and then the war file and then I deployed the
> > application. If
> > I am not wrong I should be able to search based on the field by typing
> > field:value
> > in the search box.
> >
> > But this doesn't return any results.
> >
> > Help!
> >
> >
> > On 12/14/05, Edward Quick <ed...@hotmail.com> wrote:
> >>
> >>
> >> Could this be used as a security filter to filter search results
> >> according
> >> to who the user was?
> >> The company I work for ran an evaluation of Nutch and Google, and
> >> threw
> >> Nutch out purely on the basis it didn't have that functionality :
> >> ( I'd
> >> like
> >> to see that working if possible.
> >>
> >> Ed.
> >>
> >>> Hi Kumar,
> >>>
> >>> Take a look to the creative commons plugin, it should pretty
> >>> much  what
> >> you
> >>> are looking for:
> >>> Just write a class llike:
> >>>
> >>> import org.apache.nutch.searcher.RawFieldQueryFilter;
> >>>
> >>> public class YourQueryFilter extends RawFieldQueryFilter {
> >>>   public YourQueryFilter() {
> >>>     super("luceneIndexFieldName"); // name of the field you
> >> storing  your
> >>> data in
> >>>   }
> >>> }
> >>>
> >>> Than you just need to extend the query the user is submitting with
> >>> something like:
> >>> String finalQuery = userQuery+ "luceneIndexFieldName:ThevalueToset"
> >>>
> >>> Just setup your plugin.xml that's it.
> >>>
> >>> HTH
> >>> Stefan
> >>>
> >>>
> >>>
> >>> Am 14.12.2005 um 10:58 schrieb Kumar Limbu:
> >>>
> >>>> Hi everyone,
> >>>>
> >>>> I am trying to write a custom plugin which will insert ( field
> >> and  value)
> >>>> pair into the indexed webpages depending upon its content. I have
> >>>> successfully written the plugin for parsing the data and then
> >>>> inserting
> >>>> custom information based on the contents. What I couldn't do is
> >>>> write a
> >>
> >>>> custom query filter which will return results based only on that
> >>>> particular
> >>>> field.
> >>>>
> >>>> I saw the code for urlQueryFilter but I wasn't able to
> >>>> understand  it
> >> very
> >>>> well.
> >>>>
> >>>> If you guys can help me I will be very grateful. Thank you
> >>>> everyone.
> >>>>
> >>>> --
> >>>> Keep on smiling
> >>>> :) Kumar
> >>>
> >>
> >>
> >>
> >
> >
> > --
> > Keep on smiling :) Kumar
>
>


--
Keep on smiling :) Kumar

Re: About Writing Custom queryFilter

Posted by Stefan Groschupf <sg...@media-style.com>.
Is your plugin included in the nutch-default.xml? Is it in the  
correct plugin folder?
When starting tomcat you can see the activated plugins in the log.
Stefan

Am 15.12.2005 um 11:04 schrieb Kumar Limbu:

> Hi Everyone,
>
> Thank you stefen for your help. But I just don't seem to be able to
> implement it correctly. I am quite new to nutch and I am using the  
> default
> nutch war file to search the index.
>
> I extended the RawFieldQueryFilter to create a MyQueryFilter. I  
> refered to
> the query-site to create the plugin.xml file.
>
> I built nutch and then the war file and then I deployed the  
> application. If
> I am not wrong I should be able to search based on the field by typing
> field:value
> in the search box.
>
> But this doesn't return any results.
>
> Help!
>
>
> On 12/14/05, Edward Quick <ed...@hotmail.com> wrote:
>>
>>
>> Could this be used as a security filter to filter search results  
>> according
>> to who the user was?
>> The company I work for ran an evaluation of Nutch and Google, and  
>> threw
>> Nutch out purely on the basis it didn't have that functionality : 
>> ( I'd
>> like
>> to see that working if possible.
>>
>> Ed.
>>
>>> Hi Kumar,
>>>
>>> Take a look to the creative commons plugin, it should pretty  
>>> much  what
>> you
>>> are looking for:
>>> Just write a class llike:
>>>
>>> import org.apache.nutch.searcher.RawFieldQueryFilter;
>>>
>>> public class YourQueryFilter extends RawFieldQueryFilter {
>>>   public YourQueryFilter() {
>>>     super("luceneIndexFieldName"); // name of the field you
>> storing  your
>>> data in
>>>   }
>>> }
>>>
>>> Than you just need to extend the query the user is submitting with
>>> something like:
>>> String finalQuery = userQuery+ "luceneIndexFieldName:ThevalueToset"
>>>
>>> Just setup your plugin.xml that's it.
>>>
>>> HTH
>>> Stefan
>>>
>>>
>>>
>>> Am 14.12.2005 um 10:58 schrieb Kumar Limbu:
>>>
>>>> Hi everyone,
>>>>
>>>> I am trying to write a custom plugin which will insert ( field
>> and  value)
>>>> pair into the indexed webpages depending upon its content. I have
>>>> successfully written the plugin for parsing the data and then   
>>>> inserting
>>>> custom information based on the contents. What I couldn't do is   
>>>> write a
>>
>>>> custom query filter which will return results based only on that
>>>> particular
>>>> field.
>>>>
>>>> I saw the code for urlQueryFilter but I wasn't able to  
>>>> understand  it
>> very
>>>> well.
>>>>
>>>> If you guys can help me I will be very grateful. Thank you  
>>>> everyone.
>>>>
>>>> --
>>>> Keep on smiling
>>>> :) Kumar
>>>
>>
>>
>>
>
>
> --
> Keep on smiling :) Kumar


Re: About Writing Custom queryFilter

Posted by Kumar Limbu <ku...@gmail.com>.
Hi Everyone,

Thank you stefen for your help. But I just don't seem to be able to
implement it correctly. I am quite new to nutch and I am using the default
nutch war file to search the index.

I extended the RawFieldQueryFilter to create a MyQueryFilter. I refered to
the query-site to create the plugin.xml file.

I built nutch and then the war file and then I deployed the application. If
I am not wrong I should be able to search based on the field by typing
field:value
in the search box.

But this doesn't return any results.

Help!


On 12/14/05, Edward Quick <ed...@hotmail.com> wrote:
>
>
> Could this be used as a security filter to filter search results according
> to who the user was?
> The company I work for ran an evaluation of Nutch and Google, and threw
> Nutch out purely on the basis it didn't have that functionality :( I'd
> like
> to see that working if possible.
>
> Ed.
>
> >Hi Kumar,
> >
> >Take a look to the creative commons plugin, it should pretty much  what
> you
> >are looking for:
> >Just write a class llike:
> >
> >import org.apache.nutch.searcher.RawFieldQueryFilter;
> >
> >public class YourQueryFilter extends RawFieldQueryFilter {
> >   public YourQueryFilter() {
> >     super("luceneIndexFieldName"); // name of the field you
> storing  your
> >data in
> >   }
> >}
> >
> >Than you just need to extend the query the user is submitting with
> >something like:
> >String finalQuery = userQuery+ "luceneIndexFieldName:ThevalueToset"
> >
> >Just setup your plugin.xml that's it.
> >
> >HTH
> >Stefan
> >
> >
> >
> >Am 14.12.2005 um 10:58 schrieb Kumar Limbu:
> >
> >>Hi everyone,
> >>
> >>I am trying to write a custom plugin which will insert ( field
> and  value)
> >>pair into the indexed webpages depending upon its content. I have
> >>successfully written the plugin for parsing the data and then  inserting
> >>custom information based on the contents. What I couldn't do is  write a
>
> >>custom query filter which will return results based only on that
> >>particular
> >>field.
> >>
> >>I saw the code for urlQueryFilter but I wasn't able to understand  it
> very
> >>well.
> >>
> >>If you guys can help me I will be very grateful. Thank you everyone.
> >>
> >>--
> >>Keep on smiling
> >>:) Kumar
> >
>
>
>


--
Keep on smiling :) Kumar

Re: About Writing Custom queryFilter

Posted by Edward Quick <ed...@hotmail.com>.
Could this be used as a security filter to filter search results according 
to who the user was?
The company I work for ran an evaluation of Nutch and Google, and threw 
Nutch out purely on the basis it didn't have that functionality :( I'd like 
to see that working if possible.

Ed.

>Hi Kumar,
>
>Take a look to the creative commons plugin, it should pretty much  what you 
>are looking for:
>Just write a class llike:
>
>import org.apache.nutch.searcher.RawFieldQueryFilter;
>
>public class YourQueryFilter extends RawFieldQueryFilter {
>   public YourQueryFilter() {
>     super("luceneIndexFieldName"); // name of the field you storing  your 
>data in
>   }
>}
>
>Than you just need to extend the query the user is submitting with  
>something like:
>String finalQuery = userQuery+ "luceneIndexFieldName:ThevalueToset"
>
>Just setup your plugin.xml that's it.
>
>HTH
>Stefan
>
>
>
>Am 14.12.2005 um 10:58 schrieb Kumar Limbu:
>
>>Hi everyone,
>>
>>I am trying to write a custom plugin which will insert ( field and  value)
>>pair into the indexed webpages depending upon its content. I have
>>successfully written the plugin for parsing the data and then  inserting
>>custom information based on the contents. What I couldn't do is  write a
>>custom query filter which will return results based only on that  
>>particular
>>field.
>>
>>I saw the code for urlQueryFilter but I wasn't able to understand  it very
>>well.
>>
>>If you guys can help me I will be very grateful. Thank you everyone.
>>
>>--
>>Keep on smiling
>>:) Kumar
>



Re: About Writing Custom queryFilter

Posted by Stefan Groschupf <sg...@media-style.com>.
Hi Kumar,

Take a look to the creative commons plugin, it should pretty much  
what you are looking for:
Just write a class llike:

import org.apache.nutch.searcher.RawFieldQueryFilter;

public class YourQueryFilter extends RawFieldQueryFilter {
   public YourQueryFilter() {
     super("luceneIndexFieldName"); // name of the field you storing  
your data in
   }
}

Than you just need to extend the query the user is submitting with  
something like:
String finalQuery = userQuery+ "luceneIndexFieldName:ThevalueToset"

Just setup your plugin.xml that's it.

HTH
Stefan



Am 14.12.2005 um 10:58 schrieb Kumar Limbu:

> Hi everyone,
>
> I am trying to write a custom plugin which will insert ( field and  
> value)
> pair into the indexed webpages depending upon its content. I have
> successfully written the plugin for parsing the data and then  
> inserting
> custom information based on the contents. What I couldn't do is  
> write a
> custom query filter which will return results based only on that  
> particular
> field.
>
> I saw the code for urlQueryFilter but I wasn't able to understand  
> it very
> well.
>
> If you guys can help me I will be very grateful. Thank you everyone.
>
> --
> Keep on smiling
> :) Kumar