Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367093 - [search]SolrServerException when search string contains white space at the end.
Summary: [search]SolrServerException when search string contains white space at the end.
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Server (show other bugs)
Version: 0.4   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.4 M2   Edit
Assignee: libing wang CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-19 11:02 EST by libing wang CLA
Modified: 2011-12-19 14:19 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description libing wang CLA 2011-12-19 11:02:59 EST
I happened to hit this issue when I was trying to copy a search sting and paste it in the search box.
The string contains white space at the end.
After I press enter key, I got 
GET http://localhost:8080/filesearch?sort=Path%20asc&rows=40&start=0&q=createFrame%20+Location:/file/e/* 500 (org.apache.solr.client.solrj.SolrServerException: org.apache.solr.common.SolrException: org.apache.lucene.queryParser.ParseException: Cannot parse 'createframe AND  AND Location:/file/e/* AND UserName:wwww': Encountered " <AND> "AND "" at line 1, column 17.  Was expecting one of:      <NOT> ...      "+" ...      "-" ...      "(" ...      "*" ...      <QUOTED> ...      <TERM> ...      <PREFIXTERM> ...      <WILDTERM> ...      "[" ...      "{" ...      <NUMBER> ...      <TERM> ...      "*" ...)
Comment 1 libing wang CLA 2011-12-19 11:05:32 EST
Do we support white space at the end? If not, should we eliminate the white space before constructing the URL?
Comment 2 John Arthorne CLA 2011-12-19 11:57:19 EST
Yes I think we should trim the value from the query text box before constructing the URL. In the Solr syntax whitespace is a separator between terms. Whitespace certainly gets ignored anyway in the search implementation.
Comment 3 John Arthorne CLA 2011-12-19 13:28:23 EST
I just realized this is a bug in our processing on the server.
Comment 4 John Arthorne CLA 2011-12-19 13:44:22 EST
I have released a server side fix for the 500 error:

http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=1ea7059c4690f6a94d7974dfce44e887146aefcf

However the client side post-processing will also need to trim the query so it finds the same matches.
Comment 5 John Arthorne CLA 2011-12-19 13:45:32 EST
Moving to Libing for client side part.
Comment 6 libing wang CLA 2011-12-19 14:19:59 EST
Client side code follow up.
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=c7351323fa3d587473212ca2587bbdec4d3f319f

There are two places to safe guard the code now:

1.When the search URL is constructed, it trims the white space(preceding, middle,post) from the original user input. 
2.If the white space is added directly in the URL, "in file search" will trim then as well.