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]
> >>>----- ---- --- -- - - - - - - - -
> >>>
> >>>
>


Reply via email to