1
Schema(title=TEXT(analyzer=stem_ana, stored=True),
       content=TEXT(analyzer=stem_ana, vector=True),
       link=ID(stored=True),
       meta=TEXT(analyzer=stem_ana),
       path=ID(stored=True),
       scores=ID(stored=True),
       clicks=NUMERIC(stored=True),
       file_name=ID(unique=True)
)

I am unable to retrieve the field content=TEXT(analyzer=stem_ana, vector=True)

I wan't to update the content of clicks without altering the other fields, how should I do it? I have no clue how to retrieve the contents of the fields that are not stored.

UltraInstinct
  • 43,308
  • 12
  • 81
  • 104
b1tchacked
  • 468
  • 4
  • 12
  • I figured out that i cannot retrieve the contents of the field that has it's attribute **"stored = false"**. I wan't a explanation whether i can **update** a document with the help of a file_name whose **unique=true** attribute has been set to true and changing the clicks field and leaving the content of rest of the fields as it is. – b1tchacked Jul 10 '12 at 20:00

1 Answers1

1

whoosh can't update indexed documents "in place" (just imagine one field got longer...).

So, you'ld retrieve the document from whoosh index (it will include all stored fields). If you have fields that are not stored into whoosh but kept elsewhere, you'ld need to retrieve them from these other places and add them to the document again.

Then call update_document(**fields) - whoosh will use the unique fields to remove the old indexed documents that have the same values in these fields and then index the new document.

Thomas Waldmann
  • 501
  • 2
  • 7