osome-iu / hoaxy-backend

Backend component for Hoaxy, a tool to visualize the spread of claims and fact checking
http://hoaxy.iuni.iu.edu/
GNU General Public License v3.0
138 stars 44 forks source link

Error building the lucene index #67

Closed awallemo closed 3 years ago

awallemo commented 3 years ago

When i run the command hoaxy lucene --index

2021-02-08 13:20:08,522 - hoaxy(lucene.index) - DEBUG: Indexing started.. Getting articles.. Traceback (most recent call last): File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context cursor, statement, parameters, context File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute cursor.execute(statement, parameters) psycopg2.ProgrammingError: column "html" of relation "article" does not exist LINE 2: SET html=NULL ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/ubuntu/anaconda2/envs/hoaxy/bin/hoaxy", line 11, in load_entry_point('hoaxy==0.1.0', 'console_scripts', 'hoaxy')() File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/hoaxy-0.1.0-py3.7.egg/hoaxy/commands/cmdline.py", line 122, in main File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/hoaxy-0.1.0-py3.7.egg/hoaxy/commands/lucene_cmd.py", line 166, in run File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/hoaxy-0.1.0-py3.7.egg/hoaxy/commands/lucene_cmd.py", line 108, in index File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1268, in execute clause, params or {} File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute return meth(self, multiparams, params) File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement distilled_params, File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_context e, statement, parameters, cursor, context File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 128, in reraise raise value.with_traceback(tb) File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context cursor, statement, parameters, context File "/home/ubuntu/anaconda2/envs/hoaxy/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column "html" of relation "article" does not exist LINE 2: SET html=NULL ^

[SQL: UPDATE article AS a SET html=NULL FROM UNNEST(%(gids)s) AS t(group_id) WHERE a.group_id=t.group_id ] [parameters: {'gids': [1]}]

awallemo commented 3 years ago

It seems I skipped over this step and did the last step before building the lucene index. I.e I did step 6 before step 7. Is there a way I can reverse this?

chathuriw commented 3 years ago

Above issue is because we added the html filed to the database later and forgot to update the schema. It is fixed in the master branch, but need to update the ami. Please alter the article table to have the html field.

html = Column(Text)

awallemo commented 3 years ago

Thank you chathuriw. I am not sure where I can find the database in the ami though.

chathuriw commented 3 years ago

Database details should be in conf.yaml file in .hoaxy directory in the home directory.

database:
  connect_args:
    drivername: postgresql
    host: localhost
    port: 5432
    username: hoaxy
    password: hoaxy
    database: hoaxy
  # SQLALCHEMY engine connection settings
  # http://docs.sqlalchemy.org/en/latest/core/engines.html
  pool_size: 5
  pool_recycle: -1

In the command line, do the following commands.

awallemo commented 3 years ago

Thanks, works now!