Hello Khue,

Thanks for the reference!

Thanks also for your coding example (really didn't mean you to write my code for me though... :-), but it does help...)!

As I was afraid what would happen is that the search query changes *visually* in the search input box, which looks bad. I now also get the following undesired header for the search results (which I should be able to filter though) :


Zoekresultaten voor "index NOT (pageid:1 OR pageid:2 OR pageid:3)"

The point is of course that I don't want the user to be aware of the excluded pages...
Anyway, I appreciate your help and I will see how to move forward on this.


Thanks, yours,
 Jurjan-Paul


Khue Nguyen wrote:

Hi,

you can find more info on this thread
http://list.jahia.org/dev_list/msg01338.html

given Lucene syntax, a negation only requires the NOT keyword ( must be in
uppercase ).

   searchQuery + " NOT (pageid:2 OR pageid:3)"



1. add JavaScript to the search form (through onclick() ), which will
add the extra string to the value in the input box.
Does anybody know how to do this (changing a form's value) without the
value *visually* changing in that input box?



with javascript solution, you can try the code bellow :

<%
   String notAllowedPagesStr = " NOT (pageid:1 OR pageid:11)"; //test
purpose
%>
<script language="javascript">
<!--
function onSearchFormSubmit(){
   var searchQuery = document.searchForm.searchInput.value;
   searchQuery = searchQuery.replace(/^\s*|\s*$/,""); // trim space
   if ( searchQuery.length>0 ) {
       searchQuery = searchQuery + '<%=notAllowedPagesStr%>';
   }
   document.searchForm.search.value = searchQuery;
   //alert(document.searchForm.search.value);
}
//-->
</script>
<form name="searchForm" method="get"
action="<%=jData.gui().html().drawSearchLauncher()%>"
onSubmit="onSearchFormSubmit()" >
             <p>
              <input name="searchInput" class="formVeldLogin"
type="text"/>&nbsp;&nbsp;
              <input type="hidden" name="search"/>
                <input class="button" value="zoeken" type="submit"  />
             </p>
      </form>



Regards,
Khue Nguyen


----- Original Message ----- From: "Jurjan-Paul Medema" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 16, 2004 5:08 PM
Subject: Re: limiting search to certain pages only?





Hello Khue,

Thank you, that looks really helpful!

Can I now assume that a negation to exclude pages would also work?, like
for instance:

searchQuery + " AND NOT (pageid:2 OR pageid:3)"

(I would appreciate some pointer to a reference for this syntax (mixin
of Lucene and Jahia??) Lacking documentation, a source file would do


fine.)


Now I see two alternative approaches forward:

1. add JavaScript to the search form (through onclick() ), which will
add the extra string to the value in the input box.
Does anybody know how to do this (changing a form's value) without the
value *visually* changing in that input box?

2. modify the Jahia search engine to add the extra string before the
search is carried out.
Can somebody point me to the right file for doing this?

I would prefer the first approach, as I am not in favor of extending the
code for the general case with a very specific situation...

Thanks again, yours,
 Jurjan-Paul



Khue Nguyen wrote:



ouupps,

the correct syntax is :

searchQuery + " AND (pageid:10 OR pageid:11 OR pageid:20...)"



----- Original Message ----- From: "Khue Nguyen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 16, 2004 2:15 PM
Subject: Re: limiting search to certain pages only?







Hi,

one possible way is construct you search query with all allowed pages,




like




:

searchQuery + " AND (pageId:10 OR pageId:11 OR pageId:20...)"


Regards, Khue Nguyen



----- Original Message ----- From: "Jurjan-Paul Medema" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 14, 2004 5:37 PM
Subject: limiting search to certain pages only?







Hello list,

Would it be possible to tell the search engine to only search certain
pages (excluding the top level for instance?)
(Filtering the results after the search almost works OK, except for the
paging, wich is then based on a wrong hit count...)

(This is the JSP snippet I am using right now:
          <form name="searchForm" method="get"
action="<%=jData.gui().html().drawSearchLauncher()%>">
            <p>
               <input name="search" class="formVeldLogin" type="text"
/>&nbsp;&nbsp;
               <input class="button" value="zoeken" type="submit" />
            </p>
          </form>
)

Thanks,
Jurjan-Paul

--
----- ---- --- -- - - - - - - - -
J.P. Medema
E: [EMAIL PROTECTED]
----- ---- --- -- - - - - - - - -











-- ----- ---- --- -- - - - - - - - - J.P. Medema E: [EMAIL PROTECTED] ----- ---- --- -- - - - - - - - -




Reply via email to