<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML con formato previo Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Texto de globo Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
span.HTMLconformatoprevioCar
        {mso-style-name:"HTML con formato previo Car";
        mso-style-priority:99;
        mso-style-link:"HTML con formato previo";
        font-family:Consolas;
        color:black;
        mso-fareast-language:EN-US;}
span.TextodegloboCar
        {mso-style-name:"Texto de globo Car";
        mso-style-priority:99;
        mso-style-link:"Texto de globo";
        font-family:"Tahoma","sans-serif";}
span.EstiloCorreo23
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EstiloCorreo24
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="ES" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:windowtext">Daniel, thanks for your quick response!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">By default I have configured the query modifier as “content_es:%(query) OR content_en:%(query) OR spell:%(query) OR Title_prop:%(query)”. The default OR search operator is used by default with this configuration.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">If I change this query modifier as “content_es:{!q.op=AND}%(query) OR content_en:{!q.op=AND}%(query) OR spell:{!q.op=AND}%(query) OR Title_prop:{!q.op=AND}%(query)”, the search operator is changed to AND.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">In the same way, if i change the “:{!q.op=AND}%(query)” by “”%(query)”” (query between quotations), a literal search is done.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">However, I want the user can select the way to make the search operation (AND, OR, or LITERAL), using a SELECT label with three OPTION labels in the HTML search form. When the user submit the search form,
 the results are showed.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">My problem is, how can I adapt, change or configure the default query modifier previously configured in the formatter configuration after the user submitted the form and before the formatter shows the results?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">I can have the modified query adapted with the search type using this code:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span style="color:windowtext"><c:set var="andQuery" value="{!q.op=AND}${param.q}" /> <%-- the param.q must be fixed to obtain the search query independently of the query parameter name --%><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span style="color:windowtext"><c:set var="modifiedQuery" value="${search.controller.common.config.getModifiedQuery(andQuery)}" /><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">But I do not know how to apply this change in the search configuration or status and update the search results.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><b><span style="color:windowtext;mso-fareast-language:ES">Rafael Cano Parra<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="color:windowtext;mso-fareast-language:ES">Servicio de Informática<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext;mso-fareast-language:ES">Tel.: 947 52 20 13 – Ext.: 34 941<o:p></o:p></span></p>
<p class="MsoNormal"><a href="mailto:rafaelcano@saludcastillayleon.es"><span style="color:blue;mso-fareast-language:ES">rafaelcano@saludcastillayleon.es</span></a><span style="color:windowtext;mso-fareast-language:ES"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext;mso-fareast-language:ES"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="color:#1F497D;mso-fareast-language:ES">Hospital Santos Reyes<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:ES">Avda. Ruperta Baraya, 6<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:ES">09400 Aranda de Duero (Burgos)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:ES">Tel.: 947 52 20 00 – Ext.: 34 600<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:ES">Fax: 947 52 20 12<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext;mso-fareast-language:ES"><o:p> </o:p></span></p>
<p class="MsoNormal"><a href="https://www.saludcastillayleon.es/HSReyesAranda/"><span style="color:blue;mso-fareast-language:ES;text-decoration:none"><img border="0" width="44" height="32" id="Imagen_x0020_5" src="cid:image002.jpg@01D28C36.F74F2ED0" alt="logo_hsry"></span></a><span style="color:windowtext;mso-fareast-language:ES">   
</span><a href="https://www.saludcastillayleon.es/"><span style="color:blue;mso-fareast-language:ES;text-decoration:none"><img border="0" width="63" height="32" id="Imagen_x0020_6" src="cid:image004.png@01D28C36.F74F2ED0" alt="logo_sacyl"></span></a><span style="color:windowtext;mso-fareast-language:ES">    </span><a href="https://www.jcyl.es/"><span style="color:blue;mso-fareast-language:ES;text-decoration:none"><img border="0" width="53" height="32" id="Imagen_x0020_4" src="cid:image005.png@01D28C33.DBAB40E0" alt="logo_jcyl"></span></a><span style="color:windowtext;mso-fareast-language:ES"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:ES">De:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:ES"> opencms-dev-bounces@opencms.org
 [mailto:opencms-dev-bounces@opencms.org] <b>En nombre de </b>Daniel Seidel<br>
<b>Enviado el:</b> lunes, 20 de febrero de 2017 13:22<br>
<b>Para:</b> opencms-dev@opencms.org<br>
<b>Asunto:</b> Re: [opencms-dev] AND, OR and LITERAL type search options using the JSP search functionality<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>Hi Rafael,<o:p></o:p></p>
<p>you can use the local query parameters, specifying the query modifier, i.e., {!q.op=AND}%(query). You might also consider using the modifier to add quotes for phrase search. This might only cause problems if someone enters quotes in his query.<o:p></o:p></p>
<p><o:p> </o:p></p>
<p>Best, Daniel.<o:p></o:p></p>
<p><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Am 20.02.2017 um 09:22 schrieb Cano Parra, Rafael:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Dear all,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I am configuring the JSP search functionality with a custom formatter.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I followed the documentation and the example formatter, with good results in pagination, sorting, and search content.<o:p></o:p></p>
<p class="MsoNormal">However, I can not find how to implement a type search with three options: search any word (OR option, it is the default behavior), search all words (AND option), and search a literal phrase (words between quotations).<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I found that SOLR has an option to configure AND search with local parameters (i.e., using “{¡q.op=AND}” attached before the search query), but I can not find the way to implement this with the JSP search formatter configuration, or by
 code in the formatter.<o:p></o:p></p>
<p class="MsoNormal">Also, I can not find the way to cover the search query with quotations when the “search a literal phrase” option is selected, without requiring the user to explicitly write the quotations in the search query.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Can anyone help me, please?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><b><span style="mso-fareast-language:ES">Rafael Cano Parra</span></b><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:ES">Servicio de Informática</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:ES">Tel.: 947 52 20 13 – Ext.: 34 941</span><o:p></o:p></p>
<p class="MsoNormal"><a href="mailto:rafaelcano@saludcastillayleon.es"><span style="mso-fareast-language:ES">rafaelcano@saludcastillayleon.es</span></a><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:ES"> </span><o:p></o:p></p>
<p class="MsoNormal"><b><span style="color:#1F497D;mso-fareast-language:ES">Hospital Santos Reyes</span></b><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:ES">Avda. Ruperta Baraya, 6</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:ES">09400 Aranda de Duero (Burgos)</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:ES">Tel.: 947 52 20 00 – Ext.: 34 600</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:ES">Fax: 947 52 20 12</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:ES"> </span><o:p></o:p></p>
<p class="MsoNormal"><a href="https://www.saludcastillayleon.es/HSReyesAranda/"><span style="mso-fareast-language:ES;text-decoration:none"><img border="0" width="44" height="32" id="Imagen_x0020_1" src="cid:image006.jpg@01D28C33.DBAB40E0" alt="logo_hsry"></span></a><span style="mso-fareast-language:ES">   
</span><a href="https://www.saludcastillayleon.es/"><span style="mso-fareast-language:ES;text-decoration:none"><img border="0" width="63" height="32" id="Imagen_x0020_2" src="cid:image007.png@01D28C33.DBAB40E0" alt="logo_sacyl"></span></a><span style="mso-fareast-language:ES">    </span><a href="https://www.jcyl.es/"><span style="mso-fareast-language:ES;text-decoration:none"><img border="0" width="53" height="32" id="Imagen_x0020_3" src="cid:image005.png@01D28C33.DBAB40E0" alt="logo_jcyl"></span></a><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:ES"><br>
--- AVISO SOBRE CONFIDENCIALIDAD. La legislación española ampara el secreto de las comunicaciones. Este correo electrónico y sus anexos son estrictamente confidenciales. Si Vd. no es el destinatario del mismo, por favor, notifíquenoslo inmediatamente y destruya
 el original. No deberá copiar este mensaje ni sus anexos o usarlo para propósito alguno, ni divulgar su contenido a ninguna persona. ---- ---- --- WARNING ABOUT CONFIDENTIALITY. Spanish law guarantees privacy in electronic communications. This message and
 its attachments are confidential. If you are not the intended recipient please, notify us immediately and destroy the original. You should not copy this message or use it for any purpose, nor disclose its content to any other person.
<br>
<br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>This mail is sent to you from the opencms-dev mailing list<o:p></o:p></pre>
<pre>To change your list options, or to unsubscribe from the list, please visit<o:p></o:p></pre>
<pre><a href="http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev">http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev</a><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:ES"><br>
<br>
<o:p></o:p></span></p>
<pre>-- <o:p></o:p></pre>
<pre>Kind Regards,<o:p></o:p></pre>
<pre>Daniel.<o:p></o:p></pre>
<pre> <o:p></o:p></pre>
<pre>-------------------<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Daniel Seidel<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Alkacon Software GmbH & Co. KG - The OpenCms Experts                    <o:p></o:p></pre>
<pre><a href="http://www.alkacon.com">http://www.alkacon.com</a> - <a href="http://www.opencms.org">http://www.opencms.org</a>     <o:p></o:p></pre>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:ES"><br>
--- AVISO SOBRE CONFIDENCIALIDAD. La legislación española ampara el secreto de las comunicaciones. Este correo electrónico y sus anexos son estrictamente confidenciales. Si Vd. no es el destinatario del mismo, por favor, notifíquenoslo inmediatamente y destruya
 el original. No deberá copiar este mensaje ni sus anexos o usarlo para propósito alguno, ni divulgar su contenido a ninguna persona.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:ES">---- ----
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:ES">--- WARNING ABOUT CONFIDENTIALITY. Spanish law guarantees privacy in electronic communications. This message and its attachments are confidential.
 If you are not the intended recipient please, notify us immediately and destroy the original. You should not copy this message or use it for any purpose, nor disclose its content to any other person.
<o:p></o:p></span></p>
</div>
<br>
--- AVISO SOBRE CONFIDENCIALIDAD. La legislación española ampara el secreto de las comunicaciones. Este correo electrónico y sus anexos son estrictamente confidenciales. Si Vd. no es el destinatario del mismo, por favor, notifíquenoslo inmediatamente y destruya
 el original. No deberá copiar este mensaje ni sus anexos o usarlo para propósito alguno, ni divulgar su contenido a ninguna persona.
<p></p>
---- ----
<p></p>
--- WARNING ABOUT CONFIDENTIALITY. Spanish law guarantees privacy in electronic communications. This message and its attachments are confidential. If you are not the intended recipient please, notify us immediately and destroy the original. You should not copy
 this message or use it for any purpose, nor disclose its content to any other person.
</body>
</html>