Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is there a length limitation of search query in Confluence 5.4.3?

Samuel Titka February 27, 2014

After upgrading to newest Confluence (version 5.4.3) long search queries do not work. Is there a length limitation of search query? I found out, that if I pass search query LONGER THAN 256 characters, search results in empty search page (no results found). This search query is passed through GET method .../dosearchsite.action?where=TEST&type=page&queryString=...

Example queries - first which is shorter than 256 characters - works fine, second which is longer - doesn't work:

ancestorIds:(29658282 OR 29658159 OR 29658142 OR 29658019 OR 29657896 OR 29657773 OR 29657650 OR 29657527 OR 29657404 OR 29657231 OR 29657090 OR 28543102 OR 28542832 OR 28542603 OR 28542562 OR 28542024 OR 28541754 OR 28541484) AND labelText:"mylabel"

ancestorIds:(29658405 OR 29658282 OR 29658159 OR 29658142 OR 29658019 OR 29657896 OR 29657773 OR 29657650 OR 29657527 OR 29657404 OR 29657231 OR 29657090 OR 28543102 OR 28542832 OR 28542603 OR 28542562 OR 28542024 OR 28541754 OR 28541484) AND labelText:"mylabel"

Both queries worked fine on the older version of Confluence - 4.3.5

If length is limited, is there a way how to pass longer queries?

4 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Samuel Titka April 3, 2014
0 votes
Samuel Titka April 3, 2014

POST request method did not help either :( behavior is the same - if search query is longer than 256 characters, no pages found...

0 votes
Steve Gerstner [bridgingIT]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 26, 2014

I think, there is a limit like this in some browsers for GET-requests.

Try to change the method to POST and try it again.

Regards

Steve

Samuel Titka March 26, 2014

Thank you for your answer.

You are right, there is a length limitation for GET-requests in browsers. But this has nothing to do with it. This length limit is sufficient. Besides, as I mentioned in my question - it correctly worked before Confluence upgrade. Browsers are the same.

To the second part of your answer. Is there some documentation that explains using POST method to pass search queries to Confluence that look like the one I mentioned in my question?

Best regards
Samuel

Silviu Burcea
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 26, 2014

If I'm not mistaken, GET requests length is calculated after all special characters are encoded. Maybe you passed this length without realizing it?

Steve Gerstner [bridgingIT]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 26, 2014

Samuel, you can just change the method param in the form tag to post, it will still work as XWork is usally not differnetiating between GET and POST ;)

Samuel Titka March 26, 2014

Hello Silviu Burcea,

in my opinion, Confluence developers limited length of search query to 256 characters (probably because of performance issues) in newer versions of Confluence. Am I right?

Firstly, you can't write (or paste) search query longer than 256 characters into classic search field (on page .../dosearchsite.action).
Secondly, if you pass a search query longer than this limit as GET param you won't get any found item on search result page.

And to your question - I have used encodeURIComponent() function before GET-request. This is not "GET-request" issue. I think that there is no problem with passing search query to Confluence. In my opinion Confluence recieves the search query in it's full length as input param.

@Steve Gerstner,
I'll try implement your advice. If you have any documentation or examples how should this POST-request look, I will really appreciate that.

Thanks.
Regards

Samuel

Steve Gerstner [bridgingIT]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 2, 2014

@SamuelTika: Just change the mehtod attribute of the html-form element from "GET" to "POST" ;)

You need to to this in main.vmd and search.vmd

Samuel Titka April 2, 2014

I have used following code:

jQuery.ajax({
	type: "POST",
	url: "dosearchsite.action",
	data: {queryString: myQuery},
	success: function(data) {
		...
	}
});

But again, when variable myQuery contains query string that was longer than 256 characters, Confluence did not find any result (but it should have...).

Do you have another idea how to solve this issue? I would really like be able to search with longer queries.

Steve Gerstner [bridgingIT]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 14, 2014

Ok, then your only option is to wirte your own search-action :(

0 votes
Samuel Titka March 26, 2014

Any ideas? Someone?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events