Hi all,

I found the fix for this issue and if anyone needs the fix, I'll explain. How I explained before, my idea was escape special characters before they will be sent to solr. This process is being done in the following classes:

/dspace-1.7.2-src-release/dspace-discovery/dspace-discovery-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/discovery/AbstractSearch.java

/dspace-1.7.2-src-release/dspace-discovery/dspace-discovery-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/discovery/AbstractSearch.java

In this classes I added escapeQueryChars function from solrj, who adds escape char before special characters on a string, and returns it well formatted. Next step is use this function in generateURL function:

protected String generateURL(Map<String, String> parameters)
            throws UIException {
        String query = getQuery();
        if (!"".equals(query))
        {

            query = escapeQueryChars(query);
            parameters.put("query", encodeForURL(query));
        }

Of course, if anyone knows a better solution will be welcome.

Regards


On 13/11/14 08:07, Ruben wrote:
Hi Adan,

It seems well, but it changes the type of the search that is executed. I think surrounding the query with quotes makes solr search the literal string, and only returns the searches which contains the exactly string entered. If you escape "?" character, the results list is different because executes a normal search, I don't know if I explained well....

Also thanks because it's interesting to learn tricks to search.

On 12/11/14 17:20, Adan Roman wrote:
Hi Rubén

Try surronding the query between quotes. This can work in most cases, unless the special character is a quote, of course

regards


Hi,

I noticed that if I use special characters in advanced search, solr
doesn't return any results. I read in Lucene documentation that is
possible to escape these special characters adding "\" in front of them,
and I will ask you if it's possible to modify the string query adding
the escape character before send it to search engine, and if it's
possible, how can I do it.

Thanks in advance



------------------------------------------------------------------------
<http://www.avast.com/>   

El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
www.avast.com <http://www.avast.com/>




------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk


_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette:https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette


--
........................................................................

Rubén Boada
Tècnic de Càlcul i Aplicacions
Consorci de Serveis Universitaris de Catalunya (CSUC)

Gran Capità, 2 (Edifici Nexus).08034 Barcelona
T.93 551 62 13.ruben.bo...@csuc.cat
www.csuc.cat  .Twitter @CSUC_info.Facebook.Linkedin
Subscriu-te al butlletí; (www.csuc.cat/butlleti)
........................................................................


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk


_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette


--
........................................................................

Rubén Boada
Tècnic de Càlcul i Aplicacions
Consorci de Serveis Universitaris de Catalunya (CSUC)

Gran Capità, 2 (Edifici Nexus).08034 Barcelona
T.93 551 62 13.ruben.bo...@csuc.cat
www.csuc.cat .Twitter @CSUC_info.Facebook.Linkedin
Subscriu-te al butlletí; (www.csuc.cat/butlleti)
........................................................................

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to