Open testbird opened 12 years ago
Users and Templates are regular objects in Zena. The solution to this is to change the way the fulltext search is done on the elements to ignore (idx_text_xxx fields).
There are other ways to fix this which involve adapting "SQLiss"(http://zenadmin.org/en/zafu/page443.html) so that the search query is written with any filter we want. For example:
<ul do='pages matching #{params[:q]} where ... in site limit 10'> ... display search results ... </ul>
This "matching" enhancement is interesting and would allow us to cleanup all the special code related to fulltext search. Integration with Sphinx is not trivial though.
If you are just using MySQL search, you can replace the /search thing with:
<ul do='nodes where title like "%#{params[:q]}%" and kpath not like "NDT%" and kpath not like "NRC%" in site limit 10'> ... display search results ... </ul>
replacing the " ul ..>" line in the Node-+Search.zafu caused any query to returen all? pages.
I noticed non-readable nodes are properly excluded from the results. Do the users and templates have to be a child node of the index page? (Why is it and what is a "project"?)
Could users, templates, help pages and other non site-content stuff simply be made childs of a private subpage?
I changed the code if you do not want to alter the search field, it has to be params[:q], not :s.
As for site templates and assets, if you want them to be really hidden, you have to use "fs_skin" brick. Templates have to be readable by the public in order to compile the template on the fly if the first request is a public request.
Look at http://zenadmin.org/en/documentation/Wiki/list333.html for explanations on the role of "project" and "section".
Thanks! Using the q= query the results are now free of bogus results.
Do I understand it correct that the normal (sql) search does also only consider the titles, and one needs the sphinx brick to consider the high/middle/low fields, even though they get populated even without sphinx bick?
For fulltext search, yes. These idx fields are populated inside the "versions" table, not nodes. The "versions" table is not accessible through SQLiss. If you want something close to Sphinx, you could create a property (say "search") indexed in a string index (idx_string1 for example). Then, in your models, you use prop_eval to fill the "search" field automatically. Finally, you use 'search like "%#{params[:q]}%" in site' in the query.
Note that this is really just a way to search for things, not really a fulltext search with proper ranking. And finally, the "search" index in idx_string1 is only 255 chars long for performance reasons.
We use this technique a lot to index contacts for example. Connected with a live search, it makes finding the person really easy and fast.
results do not only include content pages, but also templates and user names etc.
Reproduceable by searching for "er" and "t".