Search

I finallu succeed in adding this extenstion to the search-box on my site. But still the invalid search section error message. Do I have to make a section to make this work ??

I don't see the correct Search Index form fields/setting on http://test.tamarawobben.nl and I don't see anything (markup) on http://test.tamarawobben.nl/search-page/

Wierd. Then I do something wrong. Search index is installed and enabled. I did make the indexes. On the page search page. I did checked the Search index datasource.

That you don't see any markup is right. I can't make the xslt when on the xml I see this error message.

Here's the xml of the page :

<?xml version="1.0" encoding="utf-8" ?> 
<data> 
  <params> 
     <today>2012-01-03</today> 
      <current-time>16:56</current-time> 
      <this-year>2012</this-year>
      <this-month>01</this-month>
      <this-day>03</this-day>
      <timezone>+01:00</timezone> 
      <website-name>Tamara Wobben</website-name> 
      <page-title>search-page</page-title> 
      <root>http://test.tamarawobben.nl</root> 
      <workspace>http://test.tamarawobben.nl/workspace</workspace> 
      <root-page>search-page</root-page> 15    
      <current-page>search-page</current-page>
      <current-page-id>8</current-page-id> 
      <current-path>/search-page/?keywords=appelgebak&amp;debug</current-path> 
     <parent-path>/</parent-path> 
     <current-url>http://test.tamarawobben.nl/search-page/?keywords=appelgebak&amp;debug</current-url> 
     <upload-limit>2097152</upload-limit> 
     <symphony-version>2.2.5</symphony-version> 
     <url-keywords>appelgebak</url-keywords> 
     <cookie-username>xxx</cookie-username> 
     <cookie-pass>xxxx</cookie-pass> 
    <site-mode>live</site-mode>
</params> 
  <events /> 
     <search> 
        <error>Invalid search sections</error> 
    </search> 
</data> 

That you don't see any markup is right. I can't make the xslt when on the xml I see this error message.

I do not understand what you mean.

Anyhow: the error Invalid search sections strongly suggests that you've provided the Extension with Invalid search sections :)

Remove any hidden input field with the sections from your form HTML and take another look at the config.php sections and make sure you list the sections you want to search.

And try to provide us with the source code (full form HTML you use, XML, XSL etc).

Here's the relevant piece of the config.php :

###### SEARCH_INDEX ######
        'search_index' => array(
            're-index-per-page' => '20',
            're-index-refresh-rate' => '0.5',
            'get-param-prefix' => null,
            'get-param-keywords' => 'keywords',
            'get-param-per-page' => 'per-page',
            'get-param-sort' => 'sort',
            'get-param-direction' => 'direction',
            'get-param-sections' => 'sections',
            'get-param-page' => 'page',
            'default-sections' => null,
            'default-per-page' => '20',
            'default-sort' => 'score',
            'default-direction' => 'desc',
            'excerpt-length' => '250',
            'min-word-length' => '3',
            'max-word-length' => '30',
            'stem-words' => 'yes',
            'build-entries' => 'no',
            'mode' => 'like',
            'log-keywords' => 'yes',
                     'sections' => Sections, Dagboek , 
            'indexes' => 'a:2:{i:9;a:3:{s:6:"fields";a:3:{i:0;s:5:"titel";i:1;s:5:"tekst";i:2;s:5:"datum";}s:9:"weighting";s:1:"2";s:7:"filters";a:0:{}}i:6;a:3:{s:6:"fields";a:2:{i:0;s:5:"title";i:1;s:5:"tekst";}s:9:"weighting";s:1:"2";s:7:"filters";a:0:{}}}',
        ),
        ########
    );

And here the full html of the form :

<div id="search">
        <form method="get" id="searchform" action="http://test.tamarawobben.nl/search-page/">
          <input type="text" value="" name="keywords" id="s" class="txtField" />
          <input type="submit" id="searchsubmit" class="btnSearch" value="Find It " />
        </form>
      </div>

xslt I can make because I cannot make because the xml is only providig a error message.

Screenshot of the search page : http://imagebin.org/191585 Screenshor of the frontpage : link text Screenshot of the dagboek page : link text

And the sections are namend Sections and Dagboek

I hope I have given you what you asked for.

'sections' => Sections, Dagboek ,

should be

'sections' => 'sections, dagboek',

comment removed

@designermonkey : changed that but still the same error.

It should be the default_sections key in the config that takes this value, not sections. So, replace its current "null" value with the string designermonkey suggests.

@nickdunn I did that already but with no sucess. See my message above your message.

No, you said you had done as designermonkey suggested, changing:

'sections' => Sections, Dagboek ,

to

'sections' => 'sections, dagboek',

But I am suggesting removing that line and changing:

'default-sections' => null,

to:

'default-sections' => 'sections,dagboek',

Yes, add the section names 'sections,dagboek' to 'default-sections'.

Also, from your screenshots I see that you've added the Search Index event to your frontpage but you are using 'search-page' (http://test.tamarawobben.nl/search-page/) as your search page. So make sure you've added the Search Index event to 'search-page'

Thanks, it worked but I see something unexpected in the xml. The xml looks like this :

<search keywords="appelgebak" sort="score" direction="desc">
     <alternative-keywords> 
        ``<keyword original="appelgebak" alternative="" distance="10" /> 
`       `   </alternative-keywords> 
             <pagination total-entries="1" total-pages="1" entries-per-page="20" current-page="1" /> 
`           ` <sections>      
                 <section id="6" handle="Sections">Sections</section>
`         `      <section id="9" handle="Dagboek">Dagboek</section>         
              </sections>   
`             `<entry id="16" section="Dagboek"> 
                     <excerpt><p>Met <strong>appelgebak</strong> zijn we naar jouw opa Mans en oma Marie gegaan. Ze zijn blij voor ons en ik hoop dat je veel plezier zult hebben met je opa Mans en oma Marie zodra je bent geboren. Nu nog opa Jan en Dagmar vertellen dat je op komst bent. <strong>Appelgebak</strong> 2005-02-27&#8230;</p>
         ``</excerpt> 42
     ``</entry> 43 
`     ` </search>

As the readme stated I was expecting only the id's of the articles because build-entries are set to no.

Roelof, good to hear 'it worked'. Please tell us what you did that solved your issues: this helps other people visiting this thread.

Your XML is a bit messed up in your post but what you are seeing is a <search…/> node containing one <entry…/> node with an <excerpt>. This excerpt is not your entry but simply an excerpt that could be used.

You do not have to use the <excerpt>. You'd need to attach another 2 DS'es to your page: one to fetch the Sections entries matching your Search Index Datasource (in this case none!) and another Datasource filtering your Dagboek entries from Search Index Datasource Entry ID's (in this case 1 entry: #16).

I hope this is clear: you need to create 2 DS'es (one for each Section-you-need-to-be-searched) filtering their entries based on the Search Index DS.

What I did was what you said delete the sections line and change the default-sections line in the /manifest/config.php. And I will make 2 more DS to fetch the real data. Again many thanks from a cold Netherlands

Phew! Got there in the end.

Hi, I've started with symphony one month ago and until now I'm very happy with it. I really does it's job and does it right !

Today I had a problem when I was trying to implement search on my project. Any idea why when no results are found the xml returned contains all entries from my sources (it should return no entry, isn't it ?) ?

I setted it to filter by ds-search but seems like when ds-search is empty (so no results are found) it just returns all entries from my data-sources. I'm using xslt to not show them when there is no search result but they still exists into the xml source and I don't want to get into the xml something that I don't need. When results are found everything works fine, they filter by ds-search param.

I wonder is this is a bug or I'm doing something wrong.

Apache Version : 2.2.21
PHP Version : 5.3.8 Symphony 2.2.5

Using Union datasources extension (might that be a problem ?).

Thanks, if more details are needed let me know.

Hi,

Thanks for this great extention. I just want to talk about a small error: You forgot a "sym" in line 93 data.searchsuggestions.php ;)

++

Hi Nick,

I'm wondering if there is a way to re-index a section when entries are imported using the XML importer. Or perhaps, would there be a way to re-index using a CRON job?

I guess its not possible without adding code, so if you have any suggestion of where to begin that would be great.

Thanks a lot.

I'm wondering if there is a way to re-index a section when entries are imported using the XML importer. Or perhaps, would there be a way to re-index using a CRON job?

Yes and no. Reindexing is currently done as a series of AJAX requests, so that it is done in batches. Chomping through an entire index in one process would be too much, so I use JavaScript to build a queue of requests so that as one batch completes the next begins. You could write this as synchronous background PHP processes if you wish.

However the easier option is to make sure that the XML Importer fires the correct delegates (EntryPostCreate, EntryPostEdit etc) so that Search Index will reindex the entries as you import.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details