You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Gabriele Kahlout <ga...@mysimpatico.com> on 2011/05/14 12:36:20 UTC

How to plugin the value of a Field? DocInverterPerField?

Hello,

I'm trying to add an extra field to the schema.xml that is only stored, but
with nutch not knowing about it, I don't know how to tell Solr of its value
for each document. I'd like to plugin the computation, something like is
done with Similarity, but I'm not sure how to do that.

>From SOLR-1566 <https://issues.apache.org/jira/browse/SOLR-1566>:
"Currently it is not possible for components to add fields to outgoing
documents which are not in the the stored fields of the document."
That's my next problem, but let's say I'm okay storing the field, how do I
do that?

BTW, I tried hacking the code to add the fields a response-time to the
defaultFields per document, but since it always has a cached document it'll
not add them (I could still force the adding, but I'm not sure what else
will break as a result).

-- 
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the
receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x)
< Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email
does not contain a valid code then the email is not received. A valid code
starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈
L(-[a-z]+[0-9]X)).

Re: How to plugin the value of a Field? DocInverterPerField?

Posted by Gabriele Kahlout <ga...@mysimpatico.com>.
It looks like I've to contact
  <updateHandler class="solr.DirectUpdateHandler2"> with an AddUpdateCommand
.


On Sat, May 14, 2011 at 12:36 PM, Gabriele Kahlout <gabriele@mysimpatico.com
> wrote:

> Hello,
>
> I'm trying to add an extra field to the schema.xml that is only stored, but
> with nutch not knowing about it, I don't know how to tell Solr of its value
> for each document. I'd like to plugin the computation, something like is
> done with Similarity, but I'm not sure how to do that.
>
> From SOLR-1566 <https://issues.apache.org/jira/browse/SOLR-1566>:
> "Currently it is not possible for components to add fields to outgoing
> documents which are not in the the stored fields of the document."
> That's my next problem, but let's say I'm okay storing the field, how do I
> do that?
>
> BTW, I tried hacking the code to add the fields a response-time to the
> defaultFields per document, but since it always has a cached document it'll
> not add them (I could still force the adding, but I'm not sure what else
> will break as a result).
>
> --
> Regards,
> K. Gabriele
>
> --- unchanged since 20/9/10 ---
> P.S. If the subject contains "[LON]" or the addressee acknowledges the
> receipt within 48 hours then I don't resend the email.
> subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧
> time(x) < Now + 48h) ⇒ ¬resend(I, this).
>
> If an email is sent by a sender that is not a trusted contact or the email
> does not contain a valid code then the email is not received. A valid code
> starts with a hyphen and ends with "X".
> ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈
> L(-[a-z]+[0-9]X)).
>
>


-- 
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the
receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x)
< Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email
does not contain a valid code then the email is not received. A valid code
starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈
L(-[a-z]+[0-9]X)).

Re: How to plugin the value of a Field? DocInverterPerField?

Posted by Gabriele Kahlout <ga...@mysimpatico.com>.
Just reporting on progress:

Hacking my own ResponseWriter I manage to add the field to the doc
just-in-time before it's written. It's not that messy after all, and i
suspect the fields could also be declared in schema.xml (if we want to be
able to disable them at run-time) and only if present the value is computed
and added.
As acknowledged by others before me, there's room for refactoring
ResponseWriters to at least make them more re-usable.

Hope SOLR-1566 <https://issues.apache.org/jira/browse/SOLR-1566>  come up
with a cleaner solution.

On Sat, May 14, 2011 at 3:55 PM, Gabriele Kahlout
<ga...@mysimpatico.com>wrote:

> I calculate it from search-time + index-time field values.
> For example, say I want to print the reciprocal of the content field norm
> (available at index-time) along every document in the results. What's the
> 'clean' way of doing that?
>
>
> On Sat, May 14, 2011 at 3:42 PM, Markus Jelsma <markus.jelsma@openindex.io
> > wrote:
>
>> I'm not sure what you're trying to do. Where does the field value needs to
>> come
>> from?
>>
>> > Hello,
>> >
>> > I'm trying to add an extra field to the schema.xml that is only stored,
>> but
>> > with nutch not knowing about it, I don't know how to tell Solr of its
>> value
>> > for each document. I'd like to plugin the computation, something like is
>> > done with Similarity, but I'm not sure how to do that.
>> >
>> > From SOLR-1566 <https://issues.apache.org/jira/browse/SOLR-1566>:
>> > "Currently it is not possible for components to add fields to outgoing
>> > documents which are not in the the stored fields of the document."
>> > That's my next problem, but let's say I'm okay storing the field, how do
>> I
>> > do that?
>> >
>> > BTW, I tried hacking the code to add the fields a response-time to the
>> > defaultFields per document, but since it always has a cached document
>> it'll
>> > not add them (I could still force the adding, but I'm not sure what else
>> > will break as a result).
>>
>
>
>
> --
> Regards,
> K. Gabriele
>
> --- unchanged since 20/9/10 ---
> P.S. If the subject contains "[LON]" or the addressee acknowledges the
> receipt within 48 hours then I don't resend the email.
> subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧
> time(x) < Now + 48h) ⇒ ¬resend(I, this).
>
> If an email is sent by a sender that is not a trusted contact or the email
> does not contain a valid code then the email is not received. A valid code
> starts with a hyphen and ends with "X".
> ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈
> L(-[a-z]+[0-9]X)).
>
>


-- 
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the
receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x)
< Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email
does not contain a valid code then the email is not received. A valid code
starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈
L(-[a-z]+[0-9]X)).

Re: How to plugin the value of a Field? DocInverterPerField?

Posted by Gabriele Kahlout <ga...@mysimpatico.com>.
I calculate it from search-time + index-time field values.
For example, say I want to print the reciprocal of the content field norm
(available at index-time) along every document in the results. What's the
'clean' way of doing that?

On Sat, May 14, 2011 at 3:42 PM, Markus Jelsma
<ma...@openindex.io>wrote:

> I'm not sure what you're trying to do. Where does the field value needs to
> come
> from?
>
> > Hello,
> >
> > I'm trying to add an extra field to the schema.xml that is only stored,
> but
> > with nutch not knowing about it, I don't know how to tell Solr of its
> value
> > for each document. I'd like to plugin the computation, something like is
> > done with Similarity, but I'm not sure how to do that.
> >
> > From SOLR-1566 <https://issues.apache.org/jira/browse/SOLR-1566>:
> > "Currently it is not possible for components to add fields to outgoing
> > documents which are not in the the stored fields of the document."
> > That's my next problem, but let's say I'm okay storing the field, how do
> I
> > do that?
> >
> > BTW, I tried hacking the code to add the fields a response-time to the
> > defaultFields per document, but since it always has a cached document
> it'll
> > not add them (I could still force the adding, but I'm not sure what else
> > will break as a result).
>



-- 
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the
receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x)
< Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email
does not contain a valid code then the email is not received. A valid code
starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈
L(-[a-z]+[0-9]X)).

Re: How to plugin the value of a Field? DocInverterPerField?

Posted by Markus Jelsma <ma...@openindex.io>.
I'm not sure what you're trying to do. Where does the field value needs to come 
from? 

> Hello,
> 
> I'm trying to add an extra field to the schema.xml that is only stored, but
> with nutch not knowing about it, I don't know how to tell Solr of its value
> for each document. I'd like to plugin the computation, something like is
> done with Similarity, but I'm not sure how to do that.
> 
> From SOLR-1566 <https://issues.apache.org/jira/browse/SOLR-1566>:
> "Currently it is not possible for components to add fields to outgoing
> documents which are not in the the stored fields of the document."
> That's my next problem, but let's say I'm okay storing the field, how do I
> do that?
> 
> BTW, I tried hacking the code to add the fields a response-time to the
> defaultFields per document, but since it always has a cached document it'll
> not add them (I could still force the adding, but I'm not sure what else
> will break as a result).