Skip to main content
Inspiring
December 22, 2008
Question

Excluding page elements from Verity search

  • December 22, 2008
  • 3 replies
  • 668 views
I am working on a search function for my site.

Each page has a navigation which contains an often searched keyword (widgets for example). If I search for 'widgets' the results show every page of the site.

Can I specify a div by id within cfindex? Is there a better way to do this?

Thanks,
Paul
    This topic has been closed for replies.

    3 replies

    Inspiring
    December 23, 2008
    Paul,

    In terms of keeping the site static, I'm not sure this would work but could be worth a try. You can remove your navigation code from each file (I'm working on the assumption that your main navigation is the same from page to page--if not, let me know) and store it in a single HTML file.

    For example:
    <div id="navigation">
    <ul>
    <li><a href="##">services</a></li>
    ... and so on
    </ul>
    </div>

    In your CFM page(s), you can use a <cfinclude template="/Path/To/Nav/nav_file.htm" /> to bring this file into the page.

    With the Verity collection(s), you can tell Verity to filter/exclude HTML (*.htm, *.html) files; your previous example had code that called for Verity to index HTML files.

    I do not believe that Verity processes the CFM files when indexing; rather, it reads the actual contents of the file, which could work in your favor should the CFM files in question contain the content. Verity would index everything in the CFMs but not in the navigation HTM file.

    Not sure that's what you're looking for but hope it helps!

    Best,
    Craig

    Inspiring
    December 22, 2008
    Hi, Paul,

    Two things:
    1. Another question (sorry!). Your cfindex tags indicate that you're searching all CFM and HTM files for the index. So, how is your navigation included in your pages? I ask because you mention "Each page has a navigation which contains an often searched keyword". I think there might be a way to restructure (not in a significant way, of course :) how you pull in your navigation elements and get those to not be indexed.

    2. Are you pulling content from a database or a set of static files (i.e., XML or XHTML files that get included)? If you're pulling page content from a DB or a set of static files, it's actually a lot easier to create a collection from a query or the folder of static files and then use cfindex to index the query as a collection. If this is an option, let me know and I can help further.

    Cheers,
    Craig
    Inspiring
    December 22, 2008
    Craig,

    There are about 15 pages in the site, all of which contain static content. Each page contains the same niv structure as a <ul> and for example one of the links is for services. If someone searches for 'services' the contact us page is returned as it contains the word in the nav link.

    I was hoping not ot have to make the site DB driven to use Verity.

    Any ideas?
    Inspiring
    December 22, 2008
    Paul,

    How are you setting up your Verity collection and running the index? Is this via the CF Administrator or your code? Is it possible to post a sample?

    Cheers,
    Craig
    Inspiring
    December 22, 2008
    Hi Craig,

    Thank you. I am setting it up via cfml (no access to CF Admin).

    I have added my code below...