Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the character limit for text fields in the Confluence search API

Dong, Kevin October 28, 2022

Hello, I am working on a project that uses the Confluence search API. However, I am finding that when I make a search that goes over 25 characters, the API returns 0 results. When it is under 25 characters, the search works normally and returns me the list of search results. Is there a way to fix this? 

For reference the way I am calling the API is with:

https://mysite.atlassian.net/wiki/rest/api/content/search?cql=text~"my search"

 

1 answer

0 votes
Alex Koxaras -Relational-
Community Champion
October 28, 2022

Hi @Dong, Kevin and welcome to the community,

According to the API documentation, limit is for pagination and not for seaching over 25 characters:

limit

integer

The maximum number of content objects to return per page. Note, this may be restricted by fixed system limits.

Default: 25Minimum: 0Format: int32

https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-search/#api-wiki-rest-api-search-get

So what you are saying is that on the request you provided, when "my search" is over 25 characters, then the response returns 0? 

Dong, Kevin October 31, 2022

Hi Alex, yes that is the case. Doing searches on larger items through the API will return nothing but using the search normally on the website using the same exact search terms will return something.

Alex Koxaras -Relational-
Community Champion
October 31, 2022

Can you provide an example of your text string?

Dong, Kevin October 31, 2022

Yes, my text string is this:

search?cql=text~"Error%20code%20CAA52202"

Alex Koxaras -Relational-
Community Champion
November 1, 2022

@Dong, Kevin I've search with a similar text, but didn't get any error.

REST API is limited by default. I would expect the built-in functionalities to be better.

Dong, Kevin November 1, 2022

So is there no way for the API to be able to do searches on larger keywords/phrases? 

Alex Koxaras -Relational-
Community Champion
November 1, 2022

But I didn't encounter any problem with searching a big phrase.

I've searched for a phrase with 88 characters:

This is a big phrase which I’m searching to find inside a confluence page on my instance

And I got results:

api results.png

So I find no issue with the specific problem you are referring to. The above http request has a limitation of 25 results per page, not characters.

Dong, Kevin November 1, 2022

I see. I will go look for alternative ways to bypass this issue. Thank you for your help.

Alex Koxaras -Relational-
Community Champion
November 2, 2022

@Dong, Kevin can you post you whole http request, as well as the response you are getting? Because you shouldn't have a problem using long CQL text strings.

Dong, Kevin November 2, 2022

This is the full response:

CQL Search.PNG

Alex Koxaras -Relational-
Community Champion
November 2, 2022

And if you search from the search field inside confluence, are you getting any results? If yes, where this text is located? On the body or page title, or somewhere else?

Dong, Kevin November 2, 2022

When searching from the search field inside Confluence, I do get results. Since I'm using fuzzy search it returns all results that contain the text in both bodies and page titles.

Alex Koxaras -Relational-
Community Champion
November 2, 2022

@Dong, Kevin with a premium subscription, I would raise an Atlassian request to solve your problem. support.atlassian.com/contact

Dong, Kevin November 3, 2022

Alright I will go do that. Thank you so much for your help!

Alex Koxaras -Relational-
Community Champion
November 4, 2022

@Dong, Kevin when you get a reply from Support, please update this post here. Thanx!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events