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

Joe Desbonnet jdesbonnet at gmail.com
Sat Jan 21 17:10:34 CET 2006


I made some progress on my search problem. I had look at the
difference in some of the variables in CmsSearchIndex.search() method
when called from Site="/" and Site="JHL" (JHL is my website name). The
one that seems to make a difference is 'finalQuery'. The search
keyword is "test":

When run as Site="/"
finalQuery=+root:"root at o.c" +(meta:test content:test)
hitCount=2

When run as Site="JHL" (ie the website)
finalQuery=+root:"root at o.c sites at o.c JHL at o.c" +(meta:test content:test)
hitCount=0

So I commented out this line in CmsSearchIndex.java (approx line 583):
  pathQuery.add(phrase, false, false);
(ie remove any path restrictions in the query)

... and everything works perfectly!!

So it's something related to VFS paths. I assume that the path in the
indexsource element in opencms-search.xml is a full VFS path, and the
site root specified in the search script is relative to the website
root (?). This must be a configuration mistake on my part, but I've
followed the manual to the letter as far as I can tell.

Joe.

On 1/20/06, Joe Desbonnet <jdesbonnet at gmail.com> wrote:
> Manual rebuilding has no effect.  I've been looking at the source code
> and I believe
> this line (around line 679) in org.opencms.search.CmsSearchIndex is
> the root of my problem:
>                         if (hasReadPermission(cms, doc)) {
> ...
>
> I need to verify this and if I'm right try to understand what might
> cause hasReadPermissions() to return false.
>
> Joe.
>
>
>
> On 1/20/06, Andras Balogh <abalogh at gmail.com> wrote:
> > Hello Joe,
> >
> > Have You tried manually rebuilding Your index from Admin area having
> >  /sites/JHL/ as selected site?
> >
> > Just a thought,
> > Andras.
> >
> > Joe Desbonnet wrote:
> >
> > >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.
> > >
> > >
> > >
> >
> >
> > _______________________________________________
> > 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