This project is read-only.

Content-based search on Admin side

Topics: Writing modules
Jan 3, 2012 at 9:20 AM


I'm looking to implement a search module on the admin side.

It would allow the following: 
- search through content (HTML), allowing to find links & whatnot
- result display the list of URLs where the content was found (for pages) or the layer name & widget zone if contained in a widget

I especially need to search html, not just text.

I was planning on using the ContentManager to query the content, is this the right way to go ?

It's only for administration purposes, so it won't be used extensively. Although, it would be nice to know how such a query would perform if the website had about 1000 pages ? 

Thanks for your help !


Jan 3, 2012 at 11:03 AM

Excellent initiative (you'll upload it to the gallery when it's finished,right? :) looking forward to it )!

the disadvantage of using the default contentmanager is that you can't create a query with a like '%%' search. So maybe you can extend the contentmanager or use contain("searchquery").

Jan 3, 2012 at 11:52 AM

You can use the normal search service (same as the front-end search uses). This means you have a fuzzy / full-text search using Lucene, and all parts can participate in indexing (including BodyPart). The big disadvantage is it's not very good at partial word matches.

I've been thinking about this myself and I even started building a module (it's largely unfinished tho). I wanted to reduce redundancy by creating a search that would replace the front-end search, and be used in the back-end, and have a "pop-up search" mode which you could use for selecting content (for creating relationships, etc.)

I wanted to aggregate multiple searches; so as well as the Lucene query, you could also do a LIKE query on BodyPart to get partial-word matches. However it might just be better to implement a custom search provider for this.

I was also considering trying to reuse some of Sebastien's Projections work to try and achieve this.