[opencms-dev] What's wrong with this search script?

Joe Desbonnet jdesbonnet at gmail.com
Fri Jan 20 15:33:38 CET 2006


Uwe,

Thanks for the code. Unfortunately it behaves exactly like my own
script -- it only works while logged into the CMS and Site set to "/".

I'm not the only person who has encountered this problem: see this post
http://mail.opencms.org/pipermail/opencms-dev/2005q3/018191.html
Unfortunately there were no followups to that post.

I'm assuming that search JSP scripts are like any other JSP and can be
located anywhere within a website. Or is there something special about
search scripts? Eg do have have to be located in /system/modules/....
?  Or maybe this is some sort of permissions issue?

I think I'll continue to develop my own frontend to the OpenCms Lucene
index -- as I'm fresh out of ideas.

BTW: here excerpts of my search config in case I've done anything
stupid there. As mentioned above, the index *is* being generated.
(Software configuration is OpenCms version 6.0.2, Tomcat 5.5.9, jdk
1.5.0 on Linux).

index config:
<index>
<name>JHL</name>
<rebuild>auto</rebuild>
<project>Online</project>
<locale>en</locale>
<sources><source>jhlSource</source></sources>
</index>

here is the indexsource:
<indexsource>
<name>jhlSource</name>
<indexer class="org.opencms.search.CmsVfsIndexer" />
<resources>
<resource>/sites/JHL/</resource>
</resources>
<documenttypes-indexed>
<name>xmlpage</name>
 ... [stuff deleted for brevity] ...
</documenttypes-indexed>
</indexsource>

Thanks,
Joe.



On 1/20/06, Uwe König <uwederkoenig at web.de> wrote:
>
>
> > I just want a search function on the website :-)  Obviously it must
> > work for the general public visiting the site (I use Apache to serve
> > the site as described in the OpenCms manual).
> >
> > It's no good if you must be logged into OpenCms *and* remember to set
> > Site="/".
>
> Okay, that's not nice, indeed. All I can say that the following code works perfectly for me:
>
>                 CmsSearch search = new CmsSearch();
>                 search.init(cmsae.getCmsObject());
>                 search.setSearchRoot("/" + th.getCurrentLanguage() + "/");
>                 search.setMatchesPerPage(10);
>                 search.setPage(pageNo);
>                 search.setQuery(searchTerm);
>                 String[] fields = new String[4];
>                 fields[0] = "title";
>                 fields[1] = "content";
>                 fields[2] = "description";
>                 fields[3] = "keywords";
>                 search.setField(fields);
>                 search.setIndex("Online project (VFS)");
>
>                 List results = search.getSearchResult();
>
>
> th.getCurrentLanguage() evaluates to "en" or "jp" or the like, so I can search a language-specific subtree of my folder-structure. The rest should be clear.
> Hope this helps. Best regards,
>
> Uwe König
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list