I am using Django Haystack with ElasticSearch backend for my search page.
I am using MongoDB as my Database.
Everything was working fine in my search page.
PROBLEM
My web-application uses an external script for changing a field in the backend database using pymongo
My database has 2 fields (Files , Analysis).
The third party script runs and changes the Analysis field to True or False.
After the script has been run , when I search for the filename , it is showing me the updated Analysis in the results.
But when I search for the Analysis Field , (say I search for True/False ) It is not listing out this currently updated Analysis, though it has been updated.
For example
Search : filename
Result : filename True
Search : True
Result : No results found
It is working only after I update_index
WHAT I TRIED
So I figured out that I have to update_index. But I don't know how to update from an external python script.
I tried running
os.system("python /myapp/manage.py update_index")
I get the error
Unknown command: 'update_index'
When I checked for the management command available from the external script , it is not listing the haystack commands.
os.system("python /myapp/manage.py")
Available subcommands:
[auth]
#Things under [auth]
[contenttypes]
#Things under [contenttypes]
[django]
#Things under [django]
[sessions]
#Things under [sessions]
[staticfiles]
#Things under [staticfiles]
No haystack subcommands are being shown here , contrary to what I run in the terminal.
If I run on the terminal
#other subcommands
[haystack]
build_solr_schema
clear_index
haystack_info
rebuild_index
update_index
So I expect the result
Search :True
Results : filename True
How Do I achieve this ?
How do I update_index from an external script?
Any Other IDEAS ?