Help with PicoSearch

Can I divide my search engine into several different sections (partitions)?

Yes! You can segment your PicoSearch index into several subsections, called partitions. Each partition can be selected for searching from a dropdown menu. This is a great feature, because with it you can maximize your page limits, and give your users the effect of several search engines in one. You can make the first and default choice be to search your entire site, but have other sections that search only FAQs or user feedback or even another site altogether. For a quick demonstration on our what's new pages, see What's New? Partitions!.
 
To define and manage your partitions, go to the Search Partitions control of your account manager's Indexing topics. Partitioning is an indexing activity, so whatever changes you make must be followed by a reindexing of your account. In essence, PicoSearch is managing in the background for you the insertion and retrieval of unique codes for the documents of each partition, so that these documents may be singled out immediately to be searched within as a set.
 
The search results pages will give the options for changing the partition being searched, or you can keep the user within the partition that they started from. The first call to PicoSearch from your web page can let the partitions appear naturally, or force the launched partition, or completely override any mention of partitions, so you can indeed have different search engines seen from different pages of your site. This can therefore be a good way to handle searching different language sections of a multilingual site; see How can I use more than one display language? Templating customers with paying accounts may also wish to then tailor their templates for different search launches; see What codes can I use in my template to further customize my search results?
 

Basic Patterns: For each partition of your search, you need to provide in your account manager a keyname with no spaces, display string which can have spaces, and the files and/or directories to search. Here's an example to get you started:
partitionALL:"Search our Site"
partitionFAQs:"Search the FAQs"
http://www.mysite.com/faqlist_file.html
http://www.mysite.com/faq_directory/
Special keyname ALL will set the first partition to search all files, so no path specs are required. "Search our Site" is what your users will see in the drop-down selection for this choice, which as the first will be the default. FAQs will be the keyname of the second partition, "Search the FAQs" is what your users will see as the drop-down selection, and the left-to-right matching specifications should be chosen to include all of your FAQ files. In this example, faqlist_file.html would represent the site's master list of all FAQ links (maybe you wouldn't want it in the search or maybe you would), and each FAQ file is located under the faq_directory.
 

Advanced Patterns: Now for some more complex additional examples.
partitionTXT:"Search all text files"
*txt
partitionMTXT:"Search new meeting text files"
*meeting*txt
-*old*txt
Advanced patterns using * and - are shown for text file partitions. "Search all text files" uses a left-most star to include all files of a certain extension; in the example, the TXT partition for *txt will search all .txt files. "Search new meeting text files" uses two stars, one to catch any 'meeting' (perhaps in the file name or directory name) and one for the 'txt' extension. Furthermore, a minus sign can be used to exclude from a partition, and thus -*old*txt will not include any path with the word 'old', even if it matched the *meeting*txt pattern.

Clearly you could confuse yourself with such complex patterns, but they are powerful. Also note that the minus sign only excludes, it does not include; therefore to include all but certain files use http* first to get all, then -http://etc. to exclude the certain files.


INTITLE: One handy extension to the partition patterns is the ability to match files based not on their URL but on their HTML title string, which is located between the <title> .... <\title> tags in the HTML header code of your website pages. This is handy if your site has predictable titles that indicate the page's category. To use a title pattern, just start the pattern with INTITLE: and don't expect the implicit final wildcard anymore (since title strings aren't as left to right matching as URLs). For example, the partition pattern
INTITLE:*personal page*
could be used to make a partition of all HTML pages whose titles declare them to be a personal page, such as <title>Personal Page for Mr. Jones<\title>


LINKSFROM: Another extension to the partition patterns is the ability to maintain the list of patterns in the links of a page on your server. After the LINKSFROM: keyword, just type the full URL to the page on your site whose HTML links belong in the partition. Like a sitemap these could be full functional HTML links, thus denoting one file at a time that belongs in the partition, or they could be partition patterns. The advantage of maintaining these LINKSFROM: URLs on your site is that a database might be automatically generating the pages. The overall structure of your partitions with their names still has to be entered into PicoSearch, for example:
partitionTXT:"Search all text files"
LINKSFROM:http://www.mysite.com/partition_txt_list.html
partitionMTXT:"Search new meeting text files"
LINKSFROM:http://www.mysite.com/partition_mtxt_list.html

 
Partitions and HTML: As the examples suggest, the same file can belong to more than one partition (especially note that all files belong to the ALL partition). You don't even have to list every file for a partition in its definition, because individual files can also join partitions using the PICOPARTITION tag in their HTML. Here is the code that you would insert into any additional files that should go in the FAQs partition:
<!-- PICOPARTITION FAQs -->
The order of partitions in your specs determines the order of drop-down choices. A drop-down box will be generated on your results pages for you. How you wish to present the partition choices on your own website is up to you. See "How to Add a Search Box" in your account manager for the basic drop-down box code once you have turned on your partitions. You also can choose whether to suppress the dropdown box in your results by having the current partition only mentioned in the results, or have it not mentioned at all. These options are also in your account manager, under the partition definition that you have entered. You won't have to reindex to just change those, so you can go back and forth from test searches to see which display options you prefer.

If you want to make more complex partition menus, consider the FAQ on making a custom search box. For example, nested drop-down partition menus might be nice if you have a lot of partitions, but that would require designing with javascript and doesn't really involve PicoSearch. To help, you might just want to make partition names in your account manager that reflect the nesting, such as partitionProducts, partitionProductsHats, and partitionProductsGloves.


Dynamic Partitions: The following are the override tricks you can play from your web pages, so that the partition menu can be customized dynamically for the particular search box that your visitor is using. Just insert these optional lines into your cut-and-paste search box code. See below, where an example partition keyname would be value="FAQs" for a partition definition of partitionFAQs:"Search the FAQS" (i.e. do not include the word 'partition').
  • Use psel to force a partition selection.
    <input type="hidden" name="psel" value="(insert your partition keyname here)" />
     
  • Use phide to hide the partitions menu on the results pages. This is often used with psel to force the searching of a particular partition without the user knowing about other partitions, such as searching the English pages of a multi-national site.
    <input type="hidden" name="phide" value="1" />
     
  • Use premove to selectively remove some partitions from the menu of choices on the results page.
    <input type="hidden" name="premove" value="(insert your partition keyname here, comma separated if more than one)" />
     
  • Use ponly to show only certain partitions from the menu of choices on the results page.
    <input type="hidden" name="ponly" value="(insert your partition keyname here, comma separated if more than one)" />
If you have text links to PicoSearch from your web pages, such as a help link or a one-click entrance link, the URL equivalents for the overrides involve adding for example "&psel=FAQs" and/or "&phide=1" to the end of the link. For example, with the one-click entrance you have "ts0.pl?index=123456", where 123456 is your account ID. Thus you add:
<a href="/cgi-bin/ts0.pl?index=123456&psel=FAQs&phide=1">search</a>

For Professional and Premium Accounts only:
If you have supplied a custom search box in your template and you are using partitions with it, you will want to add _SEL_nameofpartition by itself within each OPTION tag in the partition dropdown's SELECT statements, like this: <option value="area1" _SEL_area1 />. These will be replaced automatically by PicoSearch to mark the current partition as the selected option, so the user will see the same partition being continued in a dropdown selection. This is the method by which the partitioned and customized Search our Site box on the PicoSearch homepage is kept current with the user's choice - try our search and see.

If you want to have different partition choices for different parts of your website, you could do this in two ways. First of all, the search box that starts on your website is under your control, so you can put any partition choices in any order you like there. For the search results page, you can use the phide argument (see above) to hide the choices, or the premove and ponly arguments to show only certain choices. Alternatively you could control the choices seen in the results by using PICOCALLER template codes in the the menu so different callers could fill in the HTML with different PICOCALLER arguments.

The XML/JSON datafeeds return Partition information so that customers who consume datafeed results can retrieve the partitions of each file for category style displays.









Back to FAQs