In batch search, spaces are converted to "%20" and yield no match

Open
#8 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
api

Research direction

Start with the chem.search entry point and run the provided batch-search reproduction for "potassium bicarbonate", then compare it with the working equals search. Trace where the batch query becomes "potassium%20bicarbonate"; done means batch search preserves the intended query value and returns the matching chemical.

Written by the indexing model from the issue text.

Description

Minimal reproducible example:

import ctxpy
chem = ctxpy.Chemical()

batch search fails, with search value potassium%20bicarbonate

>>> chem.search(by="batch", query=["potassium bicarbonate"])

[{'dtxsid': None, 'dtxcid': None, 'casrn': None, 'smiles': None, 'preferredName': None, 'searchName': None, 'searchValue': 'potassium%20bicarbonate', 'rank': None, 'hasStructureImage': None, 'isMarkush': None, 'searchMsgs': [...], 'suggestions': [...], 'isDuplicate': False}]

exact search works

>>> chem.search(by="equals", query="potassium bicarbonate")

[{'hasStructureImage': 1, 'smiles': '[K+].OC([O-])=O', 'isMarkush': False, 'dtxsid': 'DTXSID0021177', 'dtxcid': 'DTXCID201177', 'casrn': '298-14-6', 'preferredName': 'Potassium bicarbonate', 'searchName': 'Approved Name', 'searchValue': 'Potassium bicarbonate', 'rank': 9}]
Dominant language
Python
Stars
20
Forks
7
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from USEPA/ctx-python

All issues in USEPA/ctx-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.