[opencms-dev] Simple Search 1.4 with user name in the search field produces strange results
Trevor Lee
Trevor.Lee at 4Loop.com.au
Fri Nov 21 05:37:01 CET 2003
Hi,
I was wondering whether anyone else has experienced the problem with simple
search (using lucene 1.4) where entering a user name eg. "admin" and search
on that. It returns all articles created by admin in this instance.
I've prefixed the term with "body:".
What could be causing this behaviour?
the doSimpleSearch() method is the one below (as in SearchHelper.java):
I've included my registry file below....
public Hits doSimpleSearch(String term) throws CmsException {
try {
Searcher s = new IndexSearcher(getIndexPath());
Query q = null;
Analyzer analyzer = new StopAnalyzer();
q = QueryParser.parse(term, FIELD_BODY, analyzer);
Hits hits = s.search(q);
return hits;
} catch (java.io.IOException ioe) {
throw new CmsException("Error searching", ioe);
} catch (org.apache.lucene.queryParser.ParseException pe) {
throw new CmsException("Error parsing search string", pe);
}
}
Registry.xml
<luceneSearch>
<mergeFactor>100000</mergeFactor>
<permCheck>true</permCheck>
<indexDir>C:\Jakarta-Tomcat-4.1.12\webapps\opencms\lucene\index\</indexDir>
<analyzer>org.apache.lucene.analysis.standard.StandardAnalyzer</analyzer>
<subsearch>true</subsearch>
<project>online</project>
<docFactories>
<docFactory enabled="true" type="page">
<class>net.grcomputing.opencms.search.lucene.PageDocument</class>
</docFactory>
<docFactory enabled="true" type="plain">
<fileType name="plaintext">
<extension>.txt</extension>
<class>net.grcomputing.opencms.search.lucene.PlainDocument</class>
</fileType>
<fileType name="taggedtext">
<extension>.html</extension>
<extension>.htm</extension>
<extension>.xml</extension>
<!-- This will strip tags before processing -->
<class>net.grcomputing.opencms.search.lucene.TaggedPlainDocument</class>
</fileType>
</docFactory>
<docFactory enabled="true" type="binary">
<class>net.grcomputing.opencms.search.lucene.BodylessDocument</class>
</docFactory>
<docFactory enabled="true" type="jsp">
<class>net.grcomputing.opencms.search.lucene.JspDocument</class>
</docFactory>
<docFactory enabled="true" type="news">
<class>net.grcomputing.opencms.search.lucene.NewsDocument</class>
</docFactory>
<docFactory enabled="false" type="XML Template"/>
</docFactories>
<directories>
<directory location="/SWM/">
<section>Test</section>
<subsearch>true</subsearch>
</directory>
</directories>
<contentDefinitions>
<contentDefinition type="news">
<class>com.opencms.modules.homepage.news.NewsContentDefinition</class>
<initClass>net.grcomputing.opencms.search.lucene.NewsInitialization</initCla
ss>
<listMethod name="getSortedList">
<param type="java.lang.String"/>
</listMethod>
<page uri="/SoftwareMark/auth/news/news.jsp">
<param method="getIntId" name="id"/>
</page>
</contentDefinition>
</contentDefinitions>
</luceneSearch>
Thank you
Trevor
More information about the opencms-dev
mailing list