How to change the character limit for text fields in the Confluence search API
Asked by Dong, Kevin:

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"
```


Answers:
author: Alex Koxaras _Relational_
body: Hi [@Dong, Kevin](/t5/user/viewprofilepage/user-id/5066107) 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: `25`, Minimum: `0`, Format: `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?

comments: author: Dong, Kevin
body: 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.


author: Alex Koxaras _Relational_
body: Can you provide an example of your text string?


author: Dong, Kevin
body: Yes, my text string is this:

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


author: Alex Koxaras _Relational_
body: [@Dong, Kevin](/t5/user/viewprofilepage/user-id/5066107) 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.


author: Dong, Kevin
body: So is there no way for the API to be able to do searches on larger keywords/phrases?


author: Alex Koxaras _Relational_
body: 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](https://community.atlassian.com/t5/image/serverpage/image-id/223598i51FE2D3295158FD3/image-size/large?v=v2&px=999 "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.


author: Dong, Kevin
body: I see. I will go look for alternative ways to bypass this issue. Thank you for your help.


author: Alex Koxaras _Relational_
body: [@Dong, Kevin](/t5/user/viewprofilepage/user-id/5066107) 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.


author: Dong, Kevin
body: This is the full response:

![CQL Search.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/223827i4681657934CD66F6/image-size/large?v=v2&px=999 "CQL Search.PNG")


author: Alex Koxaras _Relational_
body: 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?


author: Dong, Kevin
body: 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.


author: Alex Koxaras _Relational_
body: [@Dong, Kevin](/t5/user/viewprofilepage/user-id/5066107) with a premium subscription, I would raise an Atlassian request to solve your problem. support.atlassian.com/contact


author: Dong, Kevin
body: Alright I will go do that. Thank you so much for your help!


author: Alex Koxaras _Relational_
body: [@Dong, Kevin](/t5/user/viewprofilepage/user-id/5066107) when you get a reply from Support, please update this post here. Thanx!


Tags: cloud

confluence-cloud