Problems, need help? Have a tip or advice? Post it here.
14 posts Page 1 of 2
I am trying to put a search function on my website, it's not working right on the website.

In my index.php, I put this source code:
Code: Select all
<?php require_once( 'admin/cms.php' ); ?>
.
.
<cms:search_form msg='Enter keywords' processor="<cms:show k_site_link/>search.php"/>
.
.
<?php COUCH::invoke(); ?>


In the search.php:
Code: Select all
<?php require_once( 'admin/cms.php' ); ?>
.
.
<cms:search_form />
               
                <cms:search>
                    <cms:if k_paginated_top >
                        <div>
                            <cms:if k_paginator_required >
                                Page <cms:show k_current_page /> of <cms:show k_total_pages /><br>
                            </cms:if>
                            <cms:show k_total_records /> Pages Found -
                            displaying: <cms:show k_record_from />-<cms:show k_record_to />
                        </div>
                    </cms:if>
               
                    <h3><a style="color:red;" href="<cms:show k_page_link/>"><cms:show k_search_title /></a></h3>
                    <cms:show k_search_excerpt />
                    <hr>
               
                    <cms:paginator />
               
                </cms:search>
.
.
<?php COUCH::invoke(); ?>



When I trying to search the result, I get this :

Image


It does not display any message or result, it just blank. What have I missed?
I could be wrong but I think you should be using

<?php require_once( 'couch/cms.php' ); ?> instead of <?php require_once( 'admin/cms.php' ); ?>
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
no, admin is right, I renamed couch to admin.
@nsy, perhaps no records are being found.
Please try putting the cms:no_results block and see what you get
Code: Select all
<cms:search>
   ...
   
   <cms:no_results>
      <h3>No pages found</h3>
   </cms:no_results>
</cms:search>
I tried this code:
Code: Select all
<cms:no_results>
      <h3>No pages found</h3>
   </cms:no_results>


It did shows no pages found. But it is really weird, Please refer following image, as you can see in this index.php, it has a title "About Us". when I trying to search "about", it shows "no pages found" which it should be found.

Image

Am I miss anything? or the couch configuration file is not configure right by me?
It's probably a misunderstanding of the search function. The search is preformed by using MySQL full-text search, this means the search is preformed on the database fields, if you manually made in your index.php a menu with some menu titles (like about us) this would not be stored in your database and thus wouldn't be found by the search function.
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
I agree with @Tomarnst. The search only uses the 'Title' field of pages and the editable regions defined for them. If the term 'About Us' appears in the title (or a text region) of some page, then it should appear in the search. Hardcoded values in HTML etc. are not searched.
I see. So it means, the couch search function can't really do the whole site keyword search unless you included it in the database?
So it means, the couch search function can't really do the whole site keyword search unless you included it in the database?
That is correct. The search feature is essentially MySQL fulltext search.
ok. I tested it. the url shown like "index.php", can I make it show like "http://www.abcd.com/index.php"?

And is that any chance that we can search by part of the keywords, example, "partnership" can be search with "partner"?
14 posts Page 1 of 2