MARCsearch($dbh,@searcharray). @searcharray contains an array with the search string (coding smthg like ””). searchable fields are defined in MARC parameter table. possible operators are =, <>, >, <, sounds soundsnot. the functions builds an array of biblios corresponding to the search string by doing atomic search (ie : builds list of biblio having author='victor', a list of biblios having 'hugo', AND-ing both, building a list of biblios having title='miserables', OR-ing the list with the previous one… how do we know which biblios have author='victor' ? simple :

  1. search which tag/subfields correspond to author in marc_subfield_parameter table
  2. build a query with tag/subfield/word (all 3 fields are indexed. if operator is sounds/soundsnot : use soundex word field, not the original word)

(note we drop 'les', it's a stopword in french ;-) ).

Note : this algorythm may build HUGE arrays, if we do something like “author <> 'victor'”. It can be better with adding “bibid in (allreadyselectedbibid1,allreadyselectedbibid2…)” in the SQL statement.

MARCgetbiblio($dbh,$bibid), sub that returns a MARC::Record for a bibid already exists in Biblio.pm. Mix MARCsearch and MARCgetbiblio, and you've got what we need

Note we use the table marc_word for searches. should be quite hard to code but VERY FAST, as we should have only indexed searches (nothing like “value like %x%”, which is a pain, as not indexed).

 
searchapi.txt · Last modified: 2006/04/04 09:23 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki