Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dimensions API - Complex search queries return 'DSL to dataframe magic methods work only with search queries.' issues when applying dsl.query() #70

Closed
NeilCollinsMS opened this issue Jul 28, 2021 · 1 comment
Labels
question Further information is requested

Comments

@NeilCollinsMS
Copy link

Documentation link: https://api-lab.dimensions.ai/cookbooks/1-getting-started/3-Working-with-dataframes.html#The-Dimcli-Python-library:-Working-with-Pandas-Dataframes

Using complex search queries yields the 'DSL to dataframe magic methods work only with search queries' error despite being applied to a stored search query. An example can be found below:

%%dsldf

query = """search publications
where
(
(research_orgs.id = "grid.######.1" and research_orgs.id = "grid.######.6")
)
and (
year = 2020
or year = 2021
)
return [id+authors+year+research_orgs]"""
res = dsl.query(query)

Adjustments have been made to query fields, but do not yield any fixes. Is it possible that this method only works on term searching?

@lambdamusic
Copy link
Member

I think you are getting the syntax wrong. After the cell magic, you can't enter Python code, just Dimensions Search Language statements. EG this works


%%dsldf

search publications
    where
    (
    (research_orgs.id = "grid.10837.3d" and research_orgs.id = "grid.4991.5")
    )
and (
    year = 2020
    or year = 2021
    )
return publications[id+authors+year+research_orgs]

See the results in my notebook:

image

@lambdamusic lambdamusic added the question Further information is requested label Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants