ENG/RUS   Main :: RiSearch :: RiSearch Pro :: RiCoord :: RiMap :: RiSearch PHP :: RiLax :: Forum

Introduction :: Manual :: Order :: License

Main

RiLax Manual

© С. Тарасов

Advanced search configuration

      To use advanced search capabilities you have to configure script. Please define types of each field (attribute). Please note, that advanced search will work only with single database or with multiple databases with similar formats (so that fields will be the same).

  • 2 - field contains HTML tags.
  • 4 - field is integer number. Comparison operations can be applied to such fields (so you can search for records where certain fields value is larger than 1000).
  • 8 - field is float number. As for integer fields, comparison operations can be used with float fields. Please note, that index for float fields will be not transferable between different platforms.
  • 16 - field is a string with date. Script will try to recognize date and store it in different format, so that comparison operations will be possible. Script can recognize date in next formats: 23.03.98, 23/03/98, 23.03.1998, Mar 23 1998. Other formats can be added if necessary. Day/month order in date (day first or month first) is defined by date_format parameter in configuration file.

      For each field you have to choose required options and put in config sum in such format:

$attr_conf[0] = 2;
$attr_conf[1] = 4;

      For example, you have database with US ZIP codes in next format:

76050;+32.336003;-097.311068;;GRANDVIEW;48;251;TX;TEXAS;JOHNSON
76051;+32.932843;-097.080802;;GRAPEVINE;48;439;TX;TEXAS;TARRANT

where fields are:

  1. 76050 - ZIP code
  2. +32.336003 - Latitude
  3. -097.311068 - Longitude
  4. "" - not used
  5. GRANDVIEW - Post Office name
  6. 48 - State code
  7. 251 - County code
  8. TX - State abbreviation
  9. TEXAS - State
  10. JOHNSON - County

      Such configuration parameters can be used in this case:

$attr_conf[0] = 4;
$attr_conf[1] = 8;
$attr_conf[2] = 8;
$attr_conf[3] = 0;
$attr_conf[4] = 0;
$attr_conf[5] = 4;
$attr_conf[6] = 4;
$attr_conf[7] = 0;
$attr_conf[8] = 0;
$attr_conf[9] = 0;

Query language

      By default script will search in all indexed fields.

  • To search in specific fields you have to add fields numbers in query string in such way: "&a=1&a=3". For example, if you want to find all ZIP codes in county DALLAS, next query can be used:

    search.pl?q=DALLAS&a=9

  • To find one word in one attribute and another word in another attribute, such queries can be used:

    search.pl?q8=TEXAS&q9=DALLAS - all ZIP codes in state TEXAS in county DALLAS

    (if parameter "q=word" is added, this word will be searched in all indexed fields).
    There is one specific query "*", like "search.pl?q8=*&q9=DALLAS". In this case script will search word "DALLAS" in field 9, not depending on value of field 8 ("q8=*" will be simply ignored).

  • Comparison operations for numeric fields:

    • a4lt=10 - value of field 4 is less then 10;
    • a4le=10 - value of field 4 is less or equal 10;
    • a4gt=10 - value of field 4 is greater then 10;
    • a4ge=10 - value of field 4 is greater or equal 10;
    • a4eq=10 - value of field 4 equal 10;
    • a4ne=10 - value of field 4 not equal 10;

    For example, all ZIP codes in range 0-1000:

    search.pl?a0gt=0&a0le=1000

    If several comparison operations are used in one query, they will be processed using "AND" logic ("a1lt=10&a2gt=10" means field 1 should be less then 10 and field 2 greater then 10). You can add parameter "ctype=OR" to change logic to "OR" ("a1lt=10&a2gt=10&ctype=OR").

    For date fields comparison operations should be used in next form:

    search.pl?q0=smith&a2gt=01.01.2000

    Results sorting

          Results can be sorted according to some field. For this parameter "s" should be used (for example "search.pl?q0=smith&a2gt=01.01.2000&s=2"). Please note that sorting by text field can take quite long time if many matches were found.

          You can sort results by several fields simultaneously (works only with text fields). For example: "q=word&s=2_3" - results will be sorted by field 2 and by field 3, if values of field 2 are equal.

    Results output

          Use such string in template - %data_N% (where N is attribute number) to print value of filed N.



  • http://risearch.org S.Tarasov, © 2000-2003