It is strange, but I can't get the ZCatalog working. Everything is done by the book and still the results are always the same full list.
You can see here: http://nfp-bg.eionet.eu.int/waste/en/search-results?catalogTextIdx=selection
What I have done so far:
- Created ZCatalog Object
- Created ZCTextIndex Lexicon with the following items
- HTMLWordSplitter
- CaseNormalizer
- StopWordRemover
- Created catalogTextIdx Index - the parameters are:
- Name(s) of attribute(s) indexed: PrincipiaSearchSource
- Index type: Okapi BM25 Rank
- ZCTextIndex Lexicon used: http://nfp-bg.eionet.eu.int/waste/catalog//catalogTextIdx/catalogLexicon
- The MetaData collected is:
- PrincipiaSearchSource
- id
- title
- The Find Object is run only for Objects of Type: DTML Document
- The list of items is created correctly for the catalog (I have removed only the css / js dtml files)
- The following code is used for the Search form:
<form action="search-results" method="get">
<input type="text" name="catalogTextIdx" id="catalogTextIdx" value="<dtml-if catalogText开发者_Python百科Idx>
<dtml-var catalogTextIdx><dtml-else>Search...</dtml-if>" class="search-field" />
<input type="submit" name="SUBMIT" value="Submit Query" class="button" />
</form>
Finally the following code is used for the Search Results Page:
<dtml-with common>&dtml.-Header;&dtml.-left-column;</dtml-with>
<td id="content" valign="top">
<h2>Search Results</h2>
<dtml-in expr="catalog(meta_type=['DTML Document'])">
<h3>Result founded: <a href="<dtml-var "catalog.getpath(data_record_id_)">"><dtml-var title></a></h3>
<dtml-var "filterRenderedHTML(PrincipiaSearchSource)">
</dtml-in>
</td>
<dtml-with common>&dtml.-right-column;&dtml.-Footer;</dtml-with>
It should be working, but it's not. I believe it should be something small, but still not sure.
Thanks in advance for all your help.
The ZCatalog has a quirk which is that if your query includes an index that does not exist in the catalog, it will return all indexed objects. In this case, your query appears to involve a "meta_type" index which you did not set up. So the ZCatalog tries to apply that index, but doesn't find it, so it returns all the items.
精彩评论