so, how about this:
 Document doc = searcher.doc(i); // i get the doc
                doc.removeField("wc"); // remove the field in case there's
                addWc(doc, docLength); //add the new field
writer.updateDocument(new Term("id", Integer.toString(i++)), doc);
//update the doc

For some reason it doesn't get added to the index. Should it?

On 7/3/11, Michael Sokolov <soko...@ifactory.com> wrote:
> You'll need to index the field.  I would think you would want to
> index/store the field along with the associated document, in which case
> you'll have to reindex the documents as well - there's no single-field
> update capability in Lucene (yet?).
>
> -Mike
>
> On 7/3/2011 1:09 PM, Gabriele Kahlout wrote:
>> Is there how I can compute and add the field to all indexed documents
>> without re-indexing? MyField counts the number of terms per document
>> (unique
>> word count).
>>
>> On Sun, Jul 3, 2011 at 12:24 PM, lee carroll
>> <lee.a.carr...@googlemail.com>wrote:
>>
>>> Hi Gabriele,
>>> Did you index any docs with your new field ?
>>>
>>> The results will just bring back docs and what fields they have. They
>>> won't
>>> bring back "null" fields just because they are in your schema. Lucene
>>> is schema-less.
>>> Solr adds the schema to make it nice to administer and very powerful to
>>> use.
>>>
>>>
>>>
>>>
>>>
>>> On 3 July 2011 11:01, Gabriele Kahlout<gabri...@mysimpatico.com>  wrote:
>>>> Hello,
>>>>
>>>> I want to have an additional  field that appears for every document in
>>>> search results. I understand that I should do this by adding the field
>>>> to
>>>> the schema.xml, so I add:
>>>>     <field name="myField" default="0" type="integer" stored="true"
>>>> indexed="false"/>
>>>> Then I restart Solr (so that I loads the new schema.xml) and make a
>>>> query
>>>> specifying that it should return myField too, but it doesn't. Will it do
>>>> only for newly indexed documents? Am I missing something?
>>>>
>>>> --
>>>> 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)).

Reply via email to