cancel
Showing results for 
Search instead for 
Did you mean: 

Solr - Mismatch character EOF expecting '''

moraisdefreitas
Champ on-the-rise
Champ on-the-rise
I’m trying to perform a search using alfresco foundation api, but I’m facing some troubles.

Follow the log when I perform a simple search (@cm:name:\”001899.xml\") by my code:


2014-11-30 17:22:58,827  DEBUG [httpclient.wire.header] [http-bio-8080-exec-1] >> "POST /solr/alfresco/afts?wt=json&fl=DBID%2Cscore&rows=1000&df=TEXT&start=0&locale=pt_BR&alternativeDic=DEFAULT_DICTIONARY&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON HTTP/1.1[\r][\n]"
2014-11-30 17:22:58,839  DEBUG [httpclient.wire.header] [http-bio-8080-exec-1] >> "Authorization: Basic YWRtaW46YWRtaW4=[\r][\n]"
2014-11-30 17:22:58,839  DEBUG [httpclient.wire.header] [http-bio-8080-exec-1] >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
2014-11-30 17:22:58,839  DEBUG [httpclient.wire.header] [http-bio-8080-exec-1] >> "Host: localhost[\r][\n]"
2014-11-30 17:22:58,839  DEBUG [httpclient.wire.header] [http-bio-8080-exec-1] >> "Content-Length: 292[\r][\n]"
2014-11-30 17:22:58,839  DEBUG [httpclient.wire.header] [http-bio-8080-exec-1] >> "Content-Type: application/json[\r][\n]"
2014-11-30 17:22:58,840  DEBUG [httpclient.wire.header] [http-bio-8080-exec-1] >> "[\r][\n]"
2014-11-30 17:22:58,840  DEBUG [httpclient.wire.content] [http-bio-8080-exec-1] >> "{"tenants":[""],"locales":["pt_BR"],"defaultNamespace":"http://www.alfresco.org/model/content/1.0','textAttributes":[],"defaultFTSOperator":"OR","defaultFTSFieldOperator":"OR","query":"@cm\\:name:\"001899.xml\"","templates":[],"allAttributes":[],"queryConsistency":"DEFAULT","authorities":[]}"
2014-11-30 17:22:59,161  ERROR [solr.core.SolrCore] [http-bio-8443-exec-3] org.alfresco.repo.search.impl.parsers.FTSQueryException: 10300000 line 1:1 mismatched character '<EOF>' expecting '"'


The same search performed by the node browser:


2014-11-30 17:24:10,053  DEBUG [httpclient.wire.content] [http-bio-8080-exec-4] >> "{"tenants":[""],"locales":["en_US"],"defaultNamespace":"http://www.alfresco.org/model/content/1.0','textAttributes":[],"defaultFTSOperator":"OR","defaultFTSFieldOperator":"OR","query":"@cm\\:name:\"001899.xml\"","templates":[],"allAttributes":[],"queryConsistency":"DEFAULT","authorities":["GROUP_EVERYONE","ROLE_ADMINISTRATOR","ROLE_AUTHENTICATED","admin"]}"
2014-11-30 17:24:10,116  DEBUG [httpclient.wire.header] [http-bio-8080-exec-4] << "HTTP/1.1 200 OK[\r][\n]"
2014-11-30 17:24:10,116  DEBUG [httpclient.wire.header] [http-bio-8080-exec-4] << "HTTP/1.1 200 OK[\r][\n]"
2014-11-30 17:24:10,116  DEBUG [httpclient.wire.header] [http-bio-8080-exec-4] << "Server: Apache-Coyote/1.1[\r][\n]"
2014-11-30 17:24:10,116  DEBUG [httpclient.wire.header] [http-bio-8080-exec-4] << "Content-Type: text/plain;charset=UTF-8[\r][\n]"
2014-11-30 17:24:10,116  DEBUG [httpclient.wire.header] [http-bio-8080-exec-4] << "Content-Length: 143[\r][\n]"
2014-11-30 17:24:10,116  DEBUG [httpclient.wire.header] [http-bio-8080-exec-4] << "Date: Sun, 30 Nov 2014 19:24:10 GMT[\r][\n]"
2014-11-30 17:24:10,116  DEBUG [httpclient.wire.header] [http-bio-8080-exec-4] << "[\r][\n]"
2014-11-30 17:24:10,117  DEBUG [httpclient.wire.content] [http-bio-8080-exec-4] << "{"responseHeader":{"status":0,"QTime":52},"response":{"numFound":1,"start":0,"maxScore":3.3113513,"docs":[{"DBID":["853"],"score":3.3113513}]}}"


The only difference I could notice was the authorities and the locale, but I do not believe that it is the cause.

My Java code:


      ResultSet results  = null;
      SearchParameters sp = new SearchParameters();
      sp.setLanguage(SearchService.LANGUAGE_SOLR_FTS_ALFRESCO);
      
      sp.setQuery("@cm\\:name:\"001899.xml\"");
      
      sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
      
      results = searchService.query(sp);

The version of Alfresco I’m using is 4.2.f.

Thanks a lot.
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

the authorities can theoretically be an issue here because they are used in the query too (as a filter query). There should always be at least one entry in the authorities array. Your code leading to an empty array has me thinking that the code runs in a context where the user has not been properly authenticated yet (or identified as a guest / anonymous user with the appropriate authority for that).
With what kind of code are you calling the SearchService? Web script / action?

Regards
Axel

Dear Axel,

That's was the point. I'm using a WebScript and, in order to perform some tests, I have included this line:


<webscript>
        …
       <authentication>none</authentication>
</webscript>


Just changed to:


<webscript>
        …
       <authentication>guest</authentication>
</webscript>


And fix the error

Thanks a lot.