Have a question regarding the search API - we are using Discourse for this crowdsourcing project: Amnesty Decoders
Basically, thousands of people from around the world are helping Amnesty International digitise documents that are hand written. Each of them does a simple task - at the end of the task, they can ask a question or make comments on a Discourse instance. Each task is done by multiple users so we can have more than one comment to a thread which is opened the first time someone comments a task.
We are having some problems with it now and hope you can help.
To post a reply to an existing task, we are using the search API. Basically, when someone posts a comment (we call it āflagā), it looks if anyone else commented the same task - if not, it creates a new topic; if yes, it replies to the the topic that has already been created by the first poster.
The problem is that the search of topic sometimes returns random topicsā¦ so users end up answering to old, completely unrelated conversationsā¦
Is there any parameter to the search API that returns the exact topic, as opposed to the approximate one
Or do you have any ideas on how we could fix this problem?
When you create the topic for the first āflagā you donāt store the topic id?
Also, if you store / have a specific format for the title, you donāt need to use the search too, for example this topic resolves properly without the ID on the URL: https://meta.discourse.org/t/search-api-parameters
The topic id is preferable but you make sound like you are not saving the topic id. Given that you donāt have the topic id (which would obviate searching), if your topics have unique names, you can just access the slug (as @falcoās example that points to this topic using the title /slug).
The way you are approaching the problem is the problem.
The first time you create a new topic, you must save the topic ID. Next time you need to direct a user to this topic, just use the same ID to create a new post.
Thanks @Falco. The problem is now that we have a Discourse instance full of existing topics and we want to allow users to reply to thoseā¦is there any search query we can run to see if the topic-slug already exists?
I signed up so that I could take a look. What you are doing looks great! This is a very interesting use of Discourse.
It looks like you are using the same pattern to create all the topic titles, with the asset_id as the unique element in each title. @Falcoās approach should be able to work for you: https://discuss.decoders.amnesty.org/t/flag-asset-number-2550.json