We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5811
    • 1,717 Posts
    AdvSearch 1.0.0 RC2 is now available from the MODx repository.

    You can download it from here.

    The description says "Dynamic content search add-on that supports results highlighting, faceted search and search in custom packages."
    beuh ... too good to be true ?
    ok so let me give you some details ...

    AdvSearch could run possibly with 3 engine modes:
    - mysql
    - zend
    - all

    With the mysql engine mode, as ajaxSearch or SimpleSearch (without Solr extension), the search occurs only inside the static content stored in the mysql database.

    With the Zend engine, the search runs first, in Lucene indexes and then retrieve from the database the content for highlighting the search terms found.
    So unlike AjaxSearch, AdvSearch could searche on dynamic content, not only on database content (with potential unparsed elements like tvs, snippets call and so on).

    AdvSearch for search in dynamic content, is based on Zend_search_lucene api. Apache Lucene(TM) is a high-performance, full-featured text search engine library written entirely in Java.
    The zend_search_lucene api is the port of Apache Lucene in Php. So no needs of a solr server with AdvSearch, you need only to install the Php Zend library before to run AdvSearch first.

    The mode "all" is a mixt of the two modes. First we get the results with the Zend mode, then we do a search with the mysql mode and we merge the results.
    So if the zend search is limited to some specific documents (pdf documents or doc resources with lot of MODx tags) we get the better of the two worlds.
    The performance with MySql and the search in dynamic content. As I haven’t run heavy tests with the mode "all", I recommend to verify the performances first before any go live.


    The developpement of this addon has been possible with the support of Marama media (Rachel) and a company of New Zealand. Thanks to them.
    AdvSearch RC1 is running on this site.

    Otherwise the features of AdvSearch RC2 are the same as ajaxSearch ... excepted that the ajax mode is missing laugh
    As much as possible I try to have the same parameter names than SimpleSearch to facilitate migration from one to other. And As the Solr extension of Simple search is also based on Lucene may be it could be possible (not checked) to use the same repository with the two add-ons.

    ====== Functional features

    - Highly customizable
    Search form and search results completely customizable through templates and css
    Result data available in templates as placeholders
    Output of results available as html results or as json structure

    - Rich query syntax
    - The syntax is the same for mysql or for the zend engine. The same search string analyser is used.
    The syntax includes:
    - single (?) and multiple character (*) wildcard searches,
    - boolean operators: AND, OR
    - the NOT operator
    - the grouping of terms using parentheses,
    - Single Terms and phrases by using quotes

    - Clear Default and help button
    - the clearing of the default text (Search here ...) is available with the clearDefault parameter
    - A customizable help button opens a window to provide an help on the search query syntax. The content of the help is fully customizable too.

    - Search in TVs:
    - Sql queries have been optimized for search in TVs.
    - fields, withFields, withTvs and includeTvs parameters allow to specify where the search occurs and which are the information available as placeholder in the results.
    - with showExtract parameter you specify which fields are used to set the extract and how many extracts per result you want

    - Faceted search
    Filter the results with the Query Hook (a snippet). By declaring the "andCondtions" in the Query Hook you can set up and manage powerfull filters.
    Read the specific Query Hook documentation.

    - Several instances on the same page
    Set as many search inputs & results as you want on the same page.

    - Dynamic content search with Zend
    (See above). By default Mysql is the default engine mode.
    To index the documents and set the Lucene repository I will provide soon a backend module.
    Until now I used a manual script.

    - Search in custom packages
    By using "joined" query hook declaration you can add joined resources to the default modResource
    The "main" declaration allow to replace modResource by an another main resource.

    - Highlighting of results
    What ever the complexity of the search terms used, there are highlighted in the extract results

    - Two paging types available
    paging type 0 : 1 | 2 | 3 | 4
    paging type 1 : Next 6-10/26 Previous


    ===== Technical pre-requisites

    - Revo 2.1 and upper (Php and MySQL versions)
    - UTF-8 charset
    - php multi-bytes ON
    - Jquery 1.5.1 (provided with advSearch)
    - Zend library 1.11 (You should manually install this library)


    ===== add-on

    Install via package management:
    - 3 snippets: AdvSearchForm, AdvSearchHelp, AdvSearch
    - 1 resource: AdvSearchHelp
    - 10 chunks
    - properties (default and properties). Available only in English. Thanks for the translations.

    The code is highly commented and easily understandable by any developper.
    it inludes 3 snippets, 5 php classes and 2 minified javascript scripts.
    All the $_REQUESTS values are sanitized before to be used for security reasons.

    I will install a new git repository at https://github.com/Coroico in the following days to support the code.

    ===== Road map

    The next steps are:

    - ajax mode
    - Bridge with Gmaps add-on
    - Search in pdf and word documents
    - Backend module to index the documents of a site (html, pdf, doc)
    - Highlighting plugin


    ===== Demos and documentation

    Demos are available here

    AdvSearch and Query Hook documentation and examples are available on this page.

    Thanks for your feedbacks. Especially on the documentation and quality of the code.






      • 28215
      • 4,149 Posts
      coroico,

      Feel free to add AdvSearch documentation to the ADDON space at rtfm.modx.com. I’ve given you access to do so.

      http://rtfm.modx.com/display/ADDON/AdvSearch
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 7045
        • 225 Posts
        I am getting the following error with the standard setup, nothing changed. I double checked my assets folder, and I don’t have a "libraries" folder. I figure I have done something wrong, even though I can’t find an answer anywhere. Oh, this error occurs no matter what I try to search for, except a blank search. I get the standard message in that situation.


        Fatal error: require_once() [function.require]: Failed opening required ’/home/deniro/public_html/clients/test4/assets/libraries/Zend/Search/Lucene.php’ (include_path=’.:/usr/lib/php:/home/deniro/public_html/clients/test4/assets/libraries/’) in /home/deniro/public_html/clients/test4/core/components/advsearch/model/advsearch/advsearch.class.php on line 140
          • 7045
          • 225 Posts
          After a little more troubleshooting, I noticed the default call is killing all AJAX on the page that has the search form (I am using FancyBox). I will go ahead and mess with the various AJAX related parameters to fix the AJAX issue. Hopefully this is what is causing my other error.
            • 7045
            • 225 Posts
            Ignore my AJAX issue, as I wasn’t checking my sites actual markup. I was getting dual JQuery library reference in the header. I added the following to my call to fix the issue. I am still dealing with the original issue.

            &addJQuery=`0`
            &jsJQuery=`http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js`
            
              • 7045
              • 225 Posts
              I have appeared to fix the issue. Well, at least the error is gone, but I need to do some more testing. Let me explain what I did, just in case this isn’t just an issue I am having.

              I downloaded the ZendFramework 1.11.10. I then created a folder call "libraries" in assets. I then uploaded the Zend folder (/ZendFramework-1.11.10/library/Zend) and it appears to have fixed my issue. I don’t know if all the folder contents are required, but I uploaded it all anyhow.
                • 7045
                • 225 Posts
                Note to self, read the entire PDF prior to posting. All the above would have been answered if I wasn’t so impatient.
                  • 7045
                  • 225 Posts
                  Ok, now I have got a real issue. I went ahead and got everything reinstalled correctly, and I setup a search box with everything default. No matter what I search for, I get the same result I get when I do a blank search:

                  There were no search results. Please try using more general terms to get more results.
                    • 7045
                    • 225 Posts
                    I am not sure if this a bug or if the PDF is wrong, but I fixed the above issue. To get the search to actually work, I had to add the "&ids" parameter to the "AdvSearch" call. The PDF says this is optional, but I had to add this to get the search working.

                    I do have an issue when I try to specify the "zend" or "all" engines, in the "&engine" parameter of the "AdxSearch" call. I get a really long error message, but I am going to try a few things before I post the error.
                      • 5811
                      • 1,717 Posts
                      You are right, &ids is requested, otherwise no results are found. This issue comes from the fact that &ids is initialized with an empty list. So with the zend engine, if you don’t find any documents inside the zend repository this is relevant to not find any results. But this is not logical with mysql. If no &ids are provided this means that you could take all the ids. I will open an issue myself as soon as I have opened a git repository.
                      I do have an issue when I try to specify the "zend" or "all" engines, in the "&engine" parameter of the "AdxSearch" call.I get a really long error message
                      Before using the "zend" or "all" engine mode, you need to have a lucene repository (/assets/files/docindex/) with some documents indexed inside. Otherwise you get this error:
                      Fatal error: Uncaught exception 'Zend_Search_Lucene_Exception' with message 'Index doesn't exists in the specified directory.' in C:\www\modxrevo\assets\libraries\Zend\Search\Lucene.php on line 566
                      I will improve the tests on the existence of the docindex folder in the next release.